How do you map this url
/Topic/topicName/action?topicId=someInt
Where Topic is the controller name (this is const – it always reads “Topic”),
topicName is being ignored
action is action name,
and someInt is the topicId argument for “action”.
Here are couple of examples:
/Topic/c-sharp/AddQuestion?topicId=1
To invoke:
Controller: Topic
Action: AddQuestion
topicId =1
Where this is the action’s singnature in TopicConroller
public ActionResult AddQuestion(int topicId)
Another example:
/Topic/MySql-queries/AddSubTopic?topicId=1
To invoke:
Controller: Topic
Action: AddSubTopic
topicId =1
Where this is the action’s singnature in TopicConroller
public ActionResult AddSubTopic(int topicId)
etc. (all actions in Topic controller receive only one argument – that is the topic’s id).
where you would have:
and if you cared about the topic name you could have your controller action take it as action parameter: