In my project, there are multiple controllers. My “books”-controller has multiple methods without any parameters.
so I changed the default mapping from:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
to:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional, action = "get" }
);
now actually this is only the case for the books controller… other controllers should be handled like the first mapping…
How can I solve this?
I’m not 100% what you are asking but this might work,