http://iwantmymvc.com/rest-service-mvc3
One thing i think could be done more straightforward than in the examples is the switching on Http method. Instead of creating a filter to add a parameter to the method call i use the HttpMethod property of the Request object wich is available in you controller.
Code Snippet
- [Authorize]
- [AcceptVerbs(HttpVerbs.Delete|HttpVerbs.Get)]
- public ActionResult activities(Guid id) {
- switch (Request.HttpMethod)
- {
- case "GET":
- return Json(new ActivityViewModel());
- case "DELETE":
- return Json(true);
- }
- return Json(new { Error = true, Message = "Unsupported HTTP verb" });
- }