0

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?

3 Answers 3

4
  • /comment/edit/{commentid}
  • /comment/delete/{commentid}
  • /comment/add/{itemid}
Sign up to request clarification or add additional context in comments.

2 Comments

Although I'd remove the itemid altogether - it's redundant
I think I agree with you, having a big route create an ugly controller
1

I suggest you remove the "details":

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

Comments

0

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

1 Comment

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.