Consider two methods on the controller CustomerController.cs:
//URL to be http://mysite/Customer/
public ActionResult Index()
{
return View("ListCustomers");
}
//URL to be http://mysite/Customer/8
public ActionResult View(int id)
{
return View("ViewCustomer");
}
- How would you setup your routes to accommodate this requirement?
- How would you use Html.ActionLink when creating a link to the View page?
In global.asax.cs, add following (suppose you use the default mvc visual studio template)
Make sure you put this route before the default route in the template
You then need to modify your controller. For the view,
For your second question, ActionLink is simple.