I'm looking to setup routes that conform to these patterns:
/users
Mapped to action GetAllUsers()
/users/12345
Mapped to action GetUser(int id)
/users/1235/favorites
mapped to action GetUserFavorites(int id)
The controller should always be the UsersController. I thought that this would work, but it's not.
routes.MapRoute("1",
"{controller}/{action}/{id}",
new { id = UrlParameter.Optional, action = "index" });
routes.MapRoute("2",
"{controller}/{id}/{action}");
I'm struggling to wrap my head around it. Any help would be much appreciated.