I’m writing an small ASP.NET MVC app, which allow read and comment for a topic.
Eg:
public Comment(int TopicID, FormCollection data)
with id is in the url (/Controller/Comment/topicid) and post is the data submited when user click on the submit button (in the same page).
Or can you show me the other way to handle my app!
thanks you so much!
You will need two different methods, one for GET and another for POST.
Use the Model (prefer) or ViewBag to pass the TopicId into the View. Save the TopicId as a hidden field.
On POST, retrieve the TopicId from the FormCollection and process accordingly.