- If you want, you can specify a common prefix for an entire controller
- To that you can use [RoutePrefix] attribute
- It's like this : [RoutePrefix("Booking")]
BookingController.cs
[RoutePrefix("Booking")]
public class BookingController : Controller
{
// eg: /Booking
[Route]
public ActionResult Index() { return View(); }
// eg: /Booking/5
[Route("{bookId}")]
public ActionResult Show(int bookId) { return View(); }
// eg: /Booking/5/Edit
[Route("{bookId}/Edit")]
public ActionResult Edit(int bookId) { return View(); }
}
Above Routes on Browser are as below