我正在使用Web和ASP.NET MVC,而且我对它非常陌生。我已经在asp.net网站上做了一些演示,我正在尝试做以下事情。
我有4个get方法,具有以下签名
public List<Customer> Get()
{
// gets all customer
}
public List<Customer> GetCustomerByCurrentMonth()
{
// gets some customer on some logic
}
public Customer GetCustomerById(string id)
{
// gets a single customer using id
}
public Customer GetCustomerByUsername(string username)
{
// gets a single customer using username
}
对于上面的所有方法,我希望我的web api如下所示
Get用户名列表Get() = api/customers/
api/customers/13
/customers/currentMonth
/customers/customerByUsername/yasser
我试着更改路由,但由于我是新手,无法理解太多。
所以,请有人能帮助我理解和指导我应该如何做。谢谢
https://stackoverflow.com/questions/12775590
复制相似问题