📜  在控制器 Web api 中添加 2 个 get 方法 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:45.130000             🧑  作者: Mango

代码示例1
[RoutePrefix("api/EmployeeApi")]
public class EmployeeApiController : ApiController
{
    //GET api/EmployeeApi
    [HttpGet]
    [Route("")]
    public List GetAllStudents() { ... }

    //GET api/EmployeeApi/EmailChange/foo/foo@email.com
    [HttpGet]
    [Route("EmailChange/{studentName}/{email}")]
    public List EmailChange(string studentName, string email) { ... }

    //GET api/EmployeeApi/AddressChange/foo/China
    [HttpGet]
    [Route("AddressChange/{studentName}/{address}")]
    public List AddressChange(string studentName, string Address) { ... }
}