UPDATED
Considering the following 8 routes where Administration is area, controller is EmployeesController and Id is EmployeeId:
Administration/Corporate/{controller}/{Id}/Phones/{PhoneId}/Delete
DeletePhoneAdministration/Corporate/{controller}/{Id}/Phones/{PhoneId}/Deactivate
DeactivatePhoneAdministration/Corporate/{controller}/{Id}/Phones/{PhoneId}/Activate
ActivatePhoneAdministration/Corporate/{controller}/{Id}/Notes/{NoteId}/Delete
DeleteNoteAdministration/Corporate/{controller}/{Id}/Files/{FileId}/Delete
DeleteFileAdministration/Corporate/{controller}/{Id}/Addresses/{AddressId}/Delete
DeleteAddressAdministration/Corporate/{controller}/{Id}/Addresses/{AddressId}/Deactivate
DeactivateAddressAdministration/Corporate/{controller}/{Id}/Addresses/{AddressId}/Activate
ActivateAddressHow can I transform it into:
Administration/Corporate/{controller}/{Id}/{object}/{ObjectId}/{action} where object is Phones|Notes|Files|Addresses|? and action is Delete|Deactivate|Activate|??
Phones (Phone)Delete+Phone (DeletePhone)I can do everything up to the second #2 where the issue is how can I transform the action into something else in the route definition?
Is any of this even possible at all? It would be nice to take the 8 routes I have now and turn them into 1. And this example only uses my EmployeesController, my CustomersController is twice that size so about 16 routes that can be turned into 1. It would save a lot of space and code.
Anyway, I'm looking forward to suggestions and ideas if this is possible.
You can create custom route handler.
public class CustomRoute : RouteBase
{
//your custom code
}
ASP.NET MVC Subdomain Routing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With