私は ASP.NET MVC で Web Api を使用していますが、これは初めてです。私はasp.net Webサイトでいくつかのデモを行っており、次のことをしようとしています。
次のシグネチャを持つ 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() =
api/customers/
- 顧客 GetCustomerById(文字列 ID) =
api/customers/13
- List GetCustomerByCurrentMonth() =
/customers/currentMonth
- 顧客 GetCustomerByUsername(文字列ユーザー名) =
/customers/customerByUsername/yasser
ルーティングを変更してみましたが、初心者なのであまり理解できませんでした。
ですから、これをどのように行うべきかを理解し、案内してくれる人がいます。ありがとう