本文整理汇总了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");
}
示例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 = "" });
}
示例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" });
}
示例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" });
}
示例5: MapResourceAddsDestroyRoute
public void MapResourceAddsDestroyRoute()
{
var routes = new RouteCollection();
routes.MapResource("patients");
AssertRoute(routes, "~/Patients/123", "DELETE",
new { controller = "Patients", action = "Destroy", id = "123" });
}
示例6: MapResourceAddsShowRoute
public void MapResourceAddsShowRoute()
{
var routes = new RouteCollection();
routes.MapResource("patients");
AssertRoute(routes, "~/Patients/123", "GET",
new { controller = "Patients", action = "Show", id = "123" });
}
示例7: MapResourceAddsCreateRoute
public void MapResourceAddsCreateRoute()
{
var routes = new RouteCollection();
routes.MapResource("patients");
AssertRoute(routes, "~/Patients", "POST",
new { controller = "Patients", action = "Create" });
}
示例8: MapResourceAddsIndexRoute
public void MapResourceAddsIndexRoute()
{
var routes = new RouteCollection();
routes.MapResource("patients");
AssertRoute(routes, "~/Patients", "GET",
new { controller = "Patients", action = "Index" });
}
示例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");
}
示例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" });
}
示例11: ResourcesAllowOptionalExtension
public void ResourcesAllowOptionalExtension()
{
var routes = new RouteCollection();
routes.MapResource("patients");
AssertRoute(routes, "~/Patients.xml", "GET",
new { controller = "Patients", action = "Index", format = "xml" });
}