I don't know if this is best practice, but I would do it like this:
Add a new route: /Author/Maps/{mapID}/Rooms/{action}/{roomID}
Since this is a route that I would expect to use only for RoomController, I would not have the {controller} parameter on that route. Just set the controller to “Rooms” in the default route object.
Then all the actions in your RoomController will know which card they are working with.
The default index action for a RoomController can be a list of all rooms for a specified map.
The Create action will look like Create(int mapID) , and the Details action will look like Details(int mapID, int roomID)
Edit: For invalid URLs with an inconsistent mapID and roomID, you can just ignore mapID, but I think that the best process would be to verify the mapID is correct and display an error message if it isn’t.
Edit 2: (additional considerations regarding the relationship between mapID and roomID) You could just make roomID unique within a given map. Therefore, card 5, room 3 will be a different room than card 8, room 3.
source share