Using Attribute Routing for your Controller

When I create a new ASP.NET MVC project one of the first things on my to do list is to implement attribute routing. It’s a much cleaner (and obvious) way to handle your POST and GET functions for your web service. Have a look at the code below: <Route("api/GetDailyStats/{UserID}/"> <HttpGet> Public Function GetDailyStats(ByVal UserID As Long) As List(Of DailyStat) End Function I can see exactly what URI path I need to call for this function, what parameters it is expecting and that this is a HTTP Get function. Setting this up is really easy. Just follow these steps: Using...

Read More