Question

just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview 5 preferably.

Was it helpful?

Solution

Check out the mvccontrib project at http://www.mvccontrib.org. In the source code a restful implementation has been added and it is current up to Preview 5. Check out the source code here - http://mvccontrib.googlecode.com/svn/trunk/src/MVCContrib/SimplyRestful

OTHER TIPS

Rails uses a "method" parameter in the form and then fakes it, but calls the appropriate method if you designate it.
I understand most clients won't support restful stack, but can asp.net mvc, auto-negotiate these verbs and place them in the appropriately deemed actions?

I've been covering this in my blog http://shouldersofgiants.co.uk/blog/ where I'm looking at an entire RESTful web service based on ASP.Net and MVC

I don't know of one off the top of my head, but you might look into the way that Rails handles it if you don't find anything else, and try porting it over. Rails utilizes POST, GET, PUT, and DELETE, but it apparently has to do some fakery for PUT. Could be worth looking into if you come up dry here.

I think that the new AcceptVerbsAttribute in preview 5 should be capable of directing any type of request to a designated action. Marking a method like below in theory allows handling of all verbs but I haven't explicitly tested put or delete.

[AcceptVerbs("delete")]
public object DoDeleteAction()

With MVC Beta, u can now use an HttpVerbs enumeration.

here's an example...

[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Index()
{ ... }

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Update()
{ ... }

[AcceptVerbs(HttpVerbs.Delete)]
public ActionResult Delete()
{ ... }

you get the idea.

hth :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top