As you saw with the method
Get(id) in the
CustomerController class, service methods in ASP.NET Web API are accessed via a URL routing convention. This convention works in a similar way to the routing in ASP.NET MVC. The biggest difference is that Web API leverages the HTTP verb to select the appropriate action in your controller.
A request is sent to your website, parsed for the HTTP verb (
DELETE), and processed through a routing engine. The routing engine uses conventions to find your controller and map the request based on verb and parameters to the appropriate action method. Recall that we set the route for the
CustomerController class at the top of the class using the attribute