Pretty basic question but I cant seem to find it in the documentation. I’ve been integrating RestfulRouting (via nuget) into an Mvc 4 app but there are situations where it would be nice to tweak the the params, either change the name or have more than one argument into the controller action.
e.g.
/resource/:id/:slug
public ActionResult Show(int id, string slug) { return View(); }
or
/resource/:custom_param_name
public ActionResult Show(string custom_param_name) { return View(); }
Is there an example or documentation that covers this scenario?
If i understand right you are trying to Route by name, not by id. with RestfulRouting.
I’m no sure if it’s 100% possible, but you can try Create Custom Routes:
Two additional methods are provided so you can add custom routes to the route set if you need to. Map is a chainable method that allows you to add standard mappings. Route is a method that will allow you to add a custom route to the route set.
e.g.
or
So you can use:
How to use it ?
How to use: Restful Routing for ASP .NET MVC
Full guide for this can be found here: RestfulRouting