I would like to set up a route for a controller that has the normal CRUD operations, but would like the Details action not show 'Details' in the URL. Stackoverflow seems to have this type of routing configured:
http://stackoverflow.com/questions/999999/
http://stackoverflow.com/questions/ask
Using this analogy, my routes currently look like:
http://stackoverflow.com/questions/Details/999999/
By adding the following route I was able to get Details removed:
routes.MapRoute("Q1", "questions/{id}",
new { controller = "Questions", action = "Details" });
However, pulling up other actions on the controller (e.g. /questions/new for this example) is complaining that the id cannot be parsed.
Is there a way to set up the routes so that I don't have to manually enter all the other actions (MapRoute "items/create", "items/delete", etc.) manually into the Global.asax.cs? I essentially would like to have a second route like:
routes.MapRoute("Q2", "questions/{action}",
new { controller = "Questions", action = "Index" });
... and have the routing engine use route Q1 if {id} matches an integer, and {action} if it is a string. Is this possible?