Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If i understand right you are trying to <a href="http://danpesolutions.blogspot.co.il/2012/10/route-by-name-not-by-id.html" rel="nofollow">Route by name, not by id.</a> with RestfulRouting.</p> <p>I'm no sure if it's 100% possible, but you can try <strong>Create Custom Routes</strong>:</p> <p><em>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.</em></p> <h2>e.g.</h2> <pre><code>Map("posts/{year}/{slug}") .To&lt;PostsController&gt;(x =&gt; x.Post(-1, "")) .Constrain("slug", @"\w+") .Constrain("year", @"\d+"); Route(new Route("posts/{action}", new RouteValueDictionary(new { controller = "posts" }), new MvcRouteHandler()); </code></pre> <hr> <h2>or</h2> <pre><code>Map("resource/{custom_param}") .To&lt;ResourcesController&gt;(x =&gt; x.Resource(-1, "")) .Constrain("custom_param", @"\w+"); Route(new Route("resource/custom", new RouteValueDictionary(new { controller = "resource" }), new MvcRouteHandler()); </code></pre> <p>So you can use:</p> <pre><code>public ActionResult Custom(string custom_param) { return View(); } </code></pre> <h2>How to use it ?</h2> <pre><code>public class Routes : RouteSet { public override void Map(Mapper map) { map.Root&lt;HomeController&gt;(x =&gt; x.Show()); map.Path("test/{id}").To&lt;TestController&gt;(x =&gt; x.Test()).Constrain("id", @"\d+"); map.Resource&lt;SessionsController&gt;(); map.Resources&lt;BlogsController&gt;(blogs =&gt; { blogs.As("weblogs"); blogs.Only("index", "show"); blogs.Collection(x =&gt; { x.Get("latest"); x.Post("someaction"); ); blogs.Member(x =&gt; x.Put("move")); blogs.Resources&lt;PostsController&gt;(posts =&gt; { posts.Except("create", "update", "destroy"); posts.Resources&lt;CommentsController&gt;(c =&gt; c.Except("destroy")); }); }); } } public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RestfulRoutingViewEngine()); RouteTable.Routes.MapRoutes&lt;Routes&gt;(); } } </code></pre> <p><em>How to use: <a href="https://github.com/stevehodgkiss/restful-routing" rel="nofollow">Restful Routing for ASP .NET MVC</a></em></p> <p><em>Full guide for this can be found here: <a href="http://stevehodgkiss.github.com/restful-routing/" rel="nofollow">RestfulRouting</a></em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload