Reputation: 983
Lets say I want use URL like http://localhost/Controller/1/ChildController/Edit/1 to access the child record(s) of a parent record in ASP.NET MVC 5 project.
Using Attribute Routing we can route like below.
[Route("Controller/{id:int}/ChildController/Edit/{childId:int}")]
public ActionResult EditChildRecord(int id, int childId)
{
return View();
}
How to achieve same in convention-based routing ?
Thanks.
Upvotes: 0
Views: 621
Reputation: 949
I think what you need it to create a areas. Create a new area, and set your controllers there. A area will be equivalent to your main controller and the controllers to yours child's controllers.
http://www.tutorialsteacher.com/mvc/area-in-asp.net-mvc
Upvotes: 0