当前位置: 首页>>代码示例>>C#>>正文


C# RouteCollection.MapResource方法代码示例

本文整理汇总了C#中RouteCollection.MapResource方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapResource方法的具体用法?C# RouteCollection.MapResource怎么用?C# RouteCollection.MapResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteCollection的用法示例。


在下文中一共展示了RouteCollection.MapResource方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterRoutes

            public void RegisterRoutes(RouteCollection routes)
            {
                routes.MapRoute(
                    "View Repo Impact",
                    "browse/{repo}/impact",
                    new { controller = "Impact", action = "ViewRepoImpact", routeName = "View Repo Impact", routeIcon = "tasks" });

                routes.MapResource("Scripts/repo-impact.js", "text/javascript");
                routes.MapResource("Scripts/g.raphael/g.impact.js", "text/javascript");
            }
开发者ID:JasSra,项目名称:WebGitNet,代码行数:10,代码来源:ImpactController.cs

示例2: RegisterRoutes

		public static void RegisterRoutes (RouteCollection routes)
		{
			
			routes.IgnoreRoute ("{resource}.axd/{*pathInfo}");
			
			routes.MapRoute (null, "contact", new { controller = "Pages", action = "Contact" });
			routes.MapRoute (null, "about", new { controller = "Pages", action = "About" });
			routes.MapRoute (null, "help", new { controller = "Pages", action = "Help" });
			
			routes.MapRoute ("New_user", "signup", new { controller = "Users", action = "New" });
			
			routes.MapRoute ("New_user_session", "signin",
			                 	new { controller = "Sessions", action = "New" },
								new { httpMethod = new RestfulHttpMethodConstraint("GET") });
			
			routes.MapRoute ("Destroy_user_session", "signout",
			                 	new { controller = "Sessions", action = "Destroy" },
								new { httpMethod = new RestfulHttpMethodConstraint("DELETE") });
			
			routes.MapRoute ("Create_user_session", "sessions",
			                 	new { controller = "Sessions", action = "Create" },
								new { httpMethod = new RestfulHttpMethodConstraint("POST") });
			
			routes.MapResource<UsersController>("users");
			
			routes.MapRoute ("Default", "{controller}/{action}/{id}", new { controller = "Pages", action = "Home", id = "" });
			
		}
开发者ID:AdamPrendergast,项目名称:Squarker_ASP.NET_MVC,代码行数:28,代码来源:Global.asax.cs

示例3: MapResourceAddsLegacyDestroyRoute

 public void MapResourceAddsLegacyDestroyRoute()
 {
     var routes = new RouteCollection();
     routes.MapResource("patients");
     AssertRoute(routes, "~/Patients/123?method=Delete", "POST",
         new { controller = "Patients", action = "Destroy", id = "123" });
 }
开发者ID:bbyars,项目名称:Castle.MonoRail.Routing,代码行数:7,代码来源:RouteCollectionExtensionsTest.cs

示例4: MapResourceAddsUpdateRoute

 public void MapResourceAddsUpdateRoute()
 {
     var routes = new RouteCollection();
     routes.MapResource("patients");
     AssertRoute(routes, "~/Patients/123?method=put", "POST",
         new { controller = "Patients", action = "Update", id = "123" });
 }
开发者ID:bbyars,项目名称:Castle.MonoRail.Routing,代码行数:7,代码来源:RouteCollectionExtensionsTest.cs

示例5: MapResourceAddsDestroyRoute

 public void MapResourceAddsDestroyRoute()
 {
     var routes = new RouteCollection();
     routes.MapResource("patients");
     AssertRoute(routes, "~/Patients/123", "DELETE",
         new { controller = "Patients", action = "Destroy", id = "123" });
 }
开发者ID:bbyars,项目名称:Castle.MonoRail.Routing,代码行数:7,代码来源:RouteCollectionExtensionsTest.cs

示例6: MapResourceAddsShowRoute

 public void MapResourceAddsShowRoute()
 {
     var routes = new RouteCollection();
     routes.MapResource("patients");
     AssertRoute(routes, "~/Patients/123", "GET",
         new { controller = "Patients", action = "Show", id = "123" });
 }
开发者ID:bbyars,项目名称:Castle.MonoRail.Routing,代码行数:7,代码来源:RouteCollectionExtensionsTest.cs

示例7: MapResourceAddsCreateRoute

 public void MapResourceAddsCreateRoute()
 {
     var routes = new RouteCollection();
     routes.MapResource("patients");
     AssertRoute(routes, "~/Patients", "POST",
         new { controller = "Patients", action = "Create" });
 }
开发者ID:bbyars,项目名称:Castle.MonoRail.Routing,代码行数:7,代码来源:RouteCollectionExtensionsTest.cs

示例8: MapResourceAddsIndexRoute

 public void MapResourceAddsIndexRoute()
 {
     var routes = new RouteCollection();
     routes.MapResource("patients");
     AssertRoute(routes, "~/Patients", "GET",
         new { controller = "Patients", action = "Index" });
 }
开发者ID:bbyars,项目名称:Castle.MonoRail.Routing,代码行数:7,代码来源:RouteCollectionExtensionsTest.cs

示例9: RegisterRoutes

        private static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapResource("", "Home");
            routes.MapResource("Exceptions/{httpStatusCode}", "Exception");
            routes.MapResource("Broken", "Broken");
            routes.MapResource("Addresses/{id}", "Address");
            routes.MapResource("Addresses", "Addresses");
            routes.MapResource("Posts", "Posts");
            routes.MapResource("Posts/{id}", "Post");
        }
开发者ID:bnathyuw,项目名称:Restful-Simple-MVC,代码行数:12,代码来源:Global.asax.cs

示例10: MapResourceAddsNestedIndex

 public void MapResourceAddsNestedIndex()
 {
     var routes = new RouteCollection();
     routes.MapResource("labs", "patients/{mrn}");
     AssertRoute(routes, "~/Patients/123/Labs", "GET",
         new { controller = "Labs", action = "Index", mrn = "123" });
 }
开发者ID:bbyars,项目名称:Castle.MonoRail.Routing,代码行数:7,代码来源:RouteCollectionExtensionsTest.cs

示例11: ResourcesAllowOptionalExtension

 public void ResourcesAllowOptionalExtension()
 {
     var routes = new RouteCollection();
     routes.MapResource("patients");
     AssertRoute(routes, "~/Patients.xml", "GET",
         new { controller = "Patients", action = "Index", format = "xml" });
 }
开发者ID:bbyars,项目名称:Castle.MonoRail.Routing,代码行数:7,代码来源:RouteCollectionExtensionsTest.cs


注:本文中的RouteCollection.MapResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。