tags:

views:

67

answers:

3

you have some info on an item and you got a list of comment on that item

how would you manage add/delete/edit with the route?

for now I have this:

/item/details/7/editcomment/1
/item/details/7/delcomment/1
/item/details/7/addcomment

is that the correct way?

+1  A: 

I suggest you remove the "details":

/item/7/editcomment/1
/item/7/delcomment/1
/item/7/addcomment

Marwan Aouida
+4  A: 
  • /comment/edit/{commentid}
  • /comment/delete/{commentid}
  • /comment/add/{itemid}
eu-ge-ne
+1 - {controller}/{action}/{id}
Mike Robinson
Although I'd remove the itemid altogether - it's redundant
Mike Robinson
Thanks Mike, you are right
eu-ge-ne
I think I agree with you, having a big route create an ugly controller
Fredou
A: 

I'd like to point out the for security reasons you'd rather not use this approach for deletion of items. Always use POST to perform any modification actions. Otherwise someone can try to abuse the system by inserting an image with a deletion link.

Of course if you just redirect users to confirmation page and they have to click submit button to initiate operation that would be okay.

Read more on Stephen Walther's blog:

ASP.NET MVC Tip #46 – Don’t use Delete Links because they create Security Holes

User
I'm using a confirmation page like it was suggested in the dinner book
Fredou