I have some controller class such as:
AdminProductController
AdminOrderController
AdminMessageController
and so on. Each controller class encapsulates admin-related tasks about particular subject. I want when user enter url like that:
Admin/Product/M1
the M1
action method of AdminProduct
called.
of course one way is :
routes.MapRoute("AdminProduct", "Admin/Product/{action}", new { controller = "AdminProduct", action = "Index" });
The problem with above code is for each controller class you must declare the above code. I want a general way to achieve this. Is there any solution?
You need to create a custom route.