In the ASP.MVC I am developing I neet to have more than one action in the url.
This is an example
BaseUrl/Release/1/Milestone/5/Feature/4
How can i configure the routes and the action methods to achieve this?
In this case I expected the action Milestone in the ReleaseController is the one that get called, with three input id:
public class ReleaseController : Controller
{
public ActionResult Milestone(int releaseID, int actionID, int secondaryID)
{
...
}
}
EDIT: Thank you @Mati Cicero to pointing me to the right direction. I followed his solution making also url a little more "dynamic". This is my final code, maybe can be useful also for someone else:
routes.MapRoute(
name: "ReleaseSection",
url: "Release/{releaseId}/{action}/{actionID}/{subAction}/{thirdID}",
defaults: new
{
controller = "Release",
action = "Index",
releaseId = UrlParameter.Optional,
actionID = UrlParameter.Optional,
subAction = UrlParameter.Optional,
thirdID = UrlParameter.Optional
}
);
public ActionResult Milestone(int? releaseId, int? actionID, string subAction, int? thirdID)
{
...
}