Answers for "adding 2 get methods in controller web api"

0

adding 2 get methods in controller web api

[RoutePrefix("api/EmployeeApi")]
public class EmployeeApiController : ApiController
{
    //GET api/EmployeeApi
    [HttpGet]
    [Route("")]
    public List<Student> GetAllStudents() { ... }

    //GET api/EmployeeApi/EmailChange/foo/[email protected]
    [HttpGet]
    [Route("EmailChange/{studentName}/{email}")]
    public List<Student> EmailChange(string studentName, string email) { ... }

    //GET api/EmployeeApi/AddressChange/foo/China
    [HttpGet]
    [Route("AddressChange/{studentName}/{address}")]
    public List<Student> AddressChange(string studentName, string Address) { ... }
}
Posted by: Guest on July-07-2020

Browse Popular Code Answers by Language