With an action name routing such as:
config.Routes.MapHttpRoute(
name: "ByActionName",
routeTemplate: "api/{controller}/{action}");
I want that all my controller methods accept the POST
verb, is there a way to configure the route map so that I don't need to put a HttpPost
attribute to all controller methods?
I was hoping to do something like:
config.Routes.MapHttpRoute(
name: "ByActionName",
verb: "POST"
routeTemplate: "api/{controller}/{action}");
Instead of:
public class MyController: ApiController
{
[HttpPost]
public List<int> GetItems() { ... }
[HttpPost]
public void DeleteItem(int id) { ... }
[HttpPost]
public void OtherMethod() { ... }
}