I'd like to use new MS Web API without having to inherit from ApiController
Ideally I'd like to create separate classes that handle only one HTTP Method and Route. For example:
// Handles GET /customer/1
public class GetCustomerHandler
{
public object Handle(int id)
{
return ...;
}
}
// Handles PUT /customer/1
public class PutCustomerHandler
{
public object Handle(NewCustomerForm form)
{
return ...;
}
}
I imagine that System.Web.Http
has plenty of extension points to allow this approach, but I can't find the appropriate documentation. Can someone point me in the right direction please?