how to access multiple methods from web api c# code example

Example: 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) { ... }
}

Tags:

Misc Example