Ejemplo n.º 1
0
 /// <summary>
 /// 映射一个 Action 路由
 /// </summary>
 /// <param name="routeTable">简单路由表实例</param>
 /// <param name="urlPattern">URL 模式</param>
 /// <param name="controller">Controller 名称</param>
 /// <param name="action">Action 名称</param>
 /// <param name="queryKeys">可用于 QueryString 的路由值</param>
 /// <returns>返回简单路由表实例,便于链式注册</returns>
 public static SimpleRouteTable MapAction(this SimpleRouteTable routeTable, string urlPattern, string controller, string action, string[] queryKeys = null)
 {
     return(routeTable.MapRoute(urlPattern, urlPattern, new Dictionary <string, string>()
     {
         { "action", action }, { "controller", controller }
     }, queryKeys));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 映射 MVC 默认路由规则
 /// </summary>
 /// <param name="routeTable">简单路由表实例</param>
 /// <returns>返回简单路由表实例,便于链式注册</returns>
 public static SimpleRouteTable MapDefaultRoute(this SimpleRouteTable routeTable)
 {
     return(routeTable.MapRoute("~/{controller}/{action}"));
 }