I'm trying to create RESTful service by using ASP.NET Web API 2. I've got a problem when there are two PUT method in my controller.
This is my model:
Subscription
- SubscriptionID (PK - Not Null)
- UserID (FK - Not Null)
- ReportGroupID (FK - Null)
- ReportID (FK - Null)
- IsSubscribe (Not Null)
- SubscribeDate (Not Null)
- UnsubscribeDate (Null)
User can subscribe per report group or per report, so I add another PUT method in Subscription
controller. I can add a route as suggested in this link, but it will become RPC-style. Furthermore, it's been 4 years ago and use ASP.NET Web API.
I'm looking for solution in ASP.NET Web API 2 with RESTful-style rather than RPC, is there a way to achieve this?
UPDATE Config code:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);