コード例 #1
0
ファイル: Routes.cs プロジェクト: abombss/restful-routing
        public override void Map(IMapper map)
        {
            map.Root<RootController>(x => x.Index());
            map.DebugRoute("routedebug");
            map.Area<BlogsController>("", area => area.Resources<BlogsController>(blogs =>
                                                                                      {
                                                                                          blogs.WithFormatRoutes();
                                                                                          blogs.Member(x => x.Get("test"));
                                                                                          blogs.Resources<PostsController>();
                                                                                      }));

            map.Area<Controllers.Admin.BlogsController>("admin", admin =>
                                                                     {
                                                                         admin.Resources<BlogsController>();
                                                                         admin.Resources<PostsController>();
                                                                     });
        }
コード例 #2
0
 public override void Map(IMapper map)
 {
     map.Resource <AnotherController>();
     map.Area <SpiesController>("danger-zone", a =>
     {
         a.Resources <SpiesController>();
     });
 }
コード例 #3
0
ファイル: Routes.cs プロジェクト: friism/restful-routing
        public override void Map(IMapper map)
        {
            map.Root <RootController>(x => x.Index());
            map.DebugRoute("routedebug");
            map.Area <BlogsController>("", area => area.Resources <BlogsController>(blogs =>
            {
                blogs.WithFormatRoutes();
                blogs.Member(x => x.Get("test"));
                blogs.Resources <PostsController>();
            }));

            map.Area <Controllers.Admin.BlogsController>("admin", admin =>
            {
                admin.Resources <BlogsController>();
                admin.Resources <PostsController>();
            });
        }
コード例 #4
0
        public override void Map(IMapper map)
        {
            //map.Path("employers/{employerSlug}")
            //{

            //}
            map.Area<UserSessionController>(AreaName, m => m.Resources<UserSessionController>());
        }
コード例 #5
0
 public override void Map(IMapper map)
 {
     map.Area <PostsController>("area", a =>
     {
         a.Resources <PostsController>(p =>
         {
             p.Resources <CommentsController>();
         });
         a.Resources <AvatarsController>();
     });
 }
コード例 #6
0
 public override void Map(IMapper map)
 {
     map.Area<PostsController>("area", a =>
     {
         a.Resources<PostsController>(p =>
         {
             p.Resources<CommentsController>();
         });
         a.Resources<AvatarsController>();
     });
 }
コード例 #7
0
ファイル: Routes.cs プロジェクト: yonglehou/restful-routing
        public override void Map(IMapper map)
        {
            // register the route debugger
            map.DebugRoute("routedebug");
            // register the root of the site
            map.Root <HomeController>(x => x.Index());
            map.Resource <QuickStartController>(quickstart => quickstart.Only("show"));

            // Connecting RouteSets: notice that we are connecting another RouteSet to this one
            map.Connect <OtherRouteSet>();

            // Mapping an area: notice, all these controllers are part of the area
            map.Area <AreasController>("mappings", area =>
            {
                area.Resource <ResourceController>();
                area.Resources <ResourcesController>(resources =>
                {
                    // we are nesting a resource inside of another resource
                    resources.Resources <OtherResourcesController>(other => other.Only("index"));
                    // using collection
                    resources.Collection(r => r.Get("many"));
                    // using member
                    resources.Member(r => r.Get("lonely"));
                });
                area.Resource <AreasController>();
                area.Resource <ExtrasController>(extras =>
                {
                    // renaming the url part
                    extras.As("extras");
                    // using member, notice collection is unavailable
                    extras.Member(e => e.Get("member"));
                    // Use path
                    extras.Path("using_path").To <ExtrasController>(e => e.UsingPath()).GetOnly();
                    // Using route
                    extras.Route(new Route("mappings/extras/with_route", new RouteValueDictionary(new { controller = "extras", action = "usingroute", area = "mappings" }), new MvcRouteHandler()));
                    // Format route action, register like always
                    extras.Member(e => e.Get("awesome"));
                    // enable format routes
                    extras.WithFormatRoutes();
                });
            });

            // Not the route debuger, just a controller
            map.Resource <RouteDebuggerController>(debug => debug.Only("show"));

            // redirects should always be last
            map.Connect <RedirectRouteSet>();
        }
コード例 #8
0
        public override void Map(IMapper map)
        {
            // register the route debugger
            map.DebugRoute("routedebug");
            // register the root of the site
            map.Root<HomeController>(x => x.Index());
            map.Resource<QuickStartController>(quickstart => quickstart.Only("show"));

            // Connecting RouteSets: notice that we are connecting another RouteSet to this one
            map.Connect<OtherRouteSet>();

            // Mapping an area: notice, all these controllers are part of the area
            map.Area<AreasController>("mappings", area => {
                area.Resource<ResourceController>();
                area.Resources<ResourcesController>(resources => {
                    // we are nesting a resource inside of another resource
                    resources.Resources<OtherResourcesController>(other => other.Only("index"));
                    // using collection
                    resources.Collection(r => r.Get("many"));
                    // using member
                    resources.Member(r => r.Get("lonely"));
                });
                area.Resource<AreasController>();
                area.Resource<ExtrasController>(extras => {
                    // renaming the url part
                    extras.As("extras");
                    // using member, notice collection is unavailable
                    extras.Member(e => e.Get("member"));
                    // Use path
                    extras.Path("using_path").To<ExtrasController>(e => e.UsingPath()).GetOnly();
                    // Using route
                    extras.Route(new Route("mappings/extras/with_route", new RouteValueDictionary(new { controller = "extras", action = "usingroute", area = "mappings" }), new MvcRouteHandler()));
                    // Format route action, register like always
                    extras.Member(e => e.Get("awesome"));
                    // enable format routes
                    extras.WithFormatRoutes();
                });
            });

            // Not the route debuger, just a controller
            map.Resource<RouteDebuggerController>(debug => debug.Only("show"));
        }
コード例 #9
0
 public override void Map(IMapper map)
 {
     map.Area<PostsController>("test", area => area.Resources<PostsController>());
 }
コード例 #10
0
 public override void Map(IMapper map)
 {
     // Given it a type so it knows its namespace.
     map.Area<Controllers.Admin.ProductsController>("admin", admin => admin.Resources<Controllers.Admin.ProductsController>(n => n.As("products")));
 }
コード例 #11
0
 public override void Map(IMapper map)
 {
     map.Area <PostsController>("test", area => area.Resources <PostsController>());
 }