Ejemplo n.º 1
0
 public void RegisterRoutes(IRoutingRuleContainer rules)
 {
     rules.Add(new PatternRoute("standard", "[controller]/[action]/[id]")
                   .DefaultForArea().IsEmpty
                   .DefaultForController().Is("Tickets")
                   .DefaultForAction().Is("Index"));
 }
Ejemplo n.º 2
0
 private static void RegisterRoutes(IRoutingRuleContainer rules)
 {
     rules.Add(new PatternRoute("root", "/")
                   .DefaultForController().Is("Home")
                   .DefaultForAction().Is("Index"));
     rules.Add(new PatternRoute("standard", "[controller]/[action]/[id]")
                   .DefaultForController().Is("Home")
                   .DefaultForAction().Is("Index"));
 }
Ejemplo n.º 3
0
        private static void RegisterRoutes(IRoutingRuleContainer rules)
        {
            rules.Add(new PatternRoute("root", "/")
                      .DefaultForController().Is("Home")
                      .DefaultForAction().Is("Index"));

            rules.Add(new PatternRoute("standard", "[controller]/[action]/[id]")
                      .DefaultForController().Is("Home")
                      .DefaultForAction().Is("Index"));
        }
Ejemplo n.º 4
0
        public static void Setup(IRoutingRuleContainer routes)
        {
            routes.Add(new PatternRoute("readme", "/readme")
            .DefaultForController().Is("home")
            .DefaultForAction().Is("readme"));

              routes.Add(new PatternRoute("home", "/[controller]/[action]")
            .DefaultForController().Is("home")
            .DefaultForAction().Is("index"));
        }
Ejemplo n.º 5
0
        public static void Register(IRoutingRuleContainer rules)
        {
            rules.Add(new RedirectRoute("", "~/home"));
            rules.Add(new RedirectRoute("/", "~/home"));

            rules.Add(new PatternRoute("<controller>/[action]")
                                        .DefaultForArea().IsEmpty
                                        .DefaultForAction().Is("index"));

            rules.Add(new PatternRoute("/security/<controller>/[action]")
                .DefaultForArea().Is("security")
                .DefaultForAction().Is("index"));
        }
Ejemplo n.º 6
0
        private static void RegisterRoutes(IRoutingRuleContainer rules)
        {
            rules.Add(new PatternRoute("root", "/")
                          .DefaultForController().Is("Episodes")
                          .DefaultForAction().Is("Index"));

            rules.Add(new PatternRoute("episodes", "Episodes/<episode>/<action>/<title>")
                          .DefaultForController().Is("Episodes")
                          .Restrict("episode").ValidInteger
                          .DefaultForAction().Is("Index"));

            rules.Add(new PatternRoute("standard", "[controller]/[action]/[id]")
                          .DefaultForController().Is("Episodes")
                          .Restrict("id").ValidInteger
                          .DefaultForAction().Is("Index"));
        }
Ejemplo n.º 7
0
        private static void RegisterRoutes(IRoutingRuleContainer rules)
        {
            rules.Add(new PatternRoute("root", "/")
                      .DefaultForController().Is("Episodes")
                      .DefaultForAction().Is("Index"));

            rules.Add(new PatternRoute("episodes", "Episodes/<episode>/<action>/<title>")
                      .DefaultForController().Is("Episodes")
                      .Restrict("episode").ValidInteger
                      .DefaultForAction().Is("Index"));

            rules.Add(new PatternRoute("standard", "[controller]/[action]/[id]")
                      .DefaultForController().Is("Episodes")
                      .Restrict("id").ValidInteger
                      .DefaultForAction().Is("Index"));
        }
Ejemplo n.º 8
0
 public WebApplication(IRoutingRuleContainer routingRuleContainer)
 {
     this.routingRuleContainer = routingRuleContainer;
 }
Ejemplo n.º 9
0
 public static void RegisterRoutes(IRoutingRuleContainer engine)
 {
     engine.Add(new PatternRoute("/<controller>/[action]/[id]")
                    .DefaultForAction().Is("index")
                    .DefaultFor("id").Is(""));
 }
Ejemplo n.º 10
0
        public static void SetupRoutes(IRoutingRuleContainer rules)
        {
            foreach (var area in Areas)
            {
                var areaname        = area.Key;
                var controllernames = area.Value.Select(GetControllerName).ToArray();
                if (string.IsNullOrEmpty(areaname))
                {
                    rules.Add(new PatternRoute(areaname + "/", "[controller]")
                              .Restrict("controller").AnyOf(controllernames)
                              .DefaultForArea().IsEmpty
                              .DefaultForController().Is("home")
                              .DefaultForAction().Is("index"));

                    rules.Add(new PatternRoute(areaname + "+/action", "<controller>/[action]")
                              .Restrict("controller").AnyOf(controllernames)
                              .DefaultForArea().IsEmpty
                              .DefaultForController().Is("home")
                              .DefaultForAction().Is("index"));

                    rules.Add(new PatternRoute(areaname + "+/id/action", "<controller>/<id>/[action]")
                              .Restrict("controller").AnyOf(controllernames)
                              .Restrict("id").ValidInteger
                              .DefaultForArea().IsEmpty
                              .DefaultForAction().Is("view"));

                    rules.Add(new PatternRoute(areaname + "+/guid/action", "<controller>/<id>/[action]")
                              .Restrict("controller").AnyOf(controllernames)
                              .Restrict("id").ValidGuid
                              .DefaultForArea().IsEmpty
                              .DefaultForController().Is("home")
                              .DefaultForAction().Is("view"));
                }
                else
                {
                    var actionnames = area.Value.SelectMany(GetActions).Distinct().ToArray();
                    rules.Add(new PatternRoute(areaname + "+/action", "<area>/<controller>/[action]")
                              .Restrict("area").AnyOf(new [] { areaname })
                              .Restrict("controller").AnyOf(controllernames)
                              .Restrict("action").AnyOf(actionnames)
                              .DefaultForAction().Is("index"));

                    rules.Add(new PatternRoute(areaname + "+/id/action", "<area>/<controller>/<id>/[action]")
                              .Restrict("area").AnyOf(new [] { areaname })
                              .Restrict("controller").AnyOf(controllernames)
                              .Restrict("action").AnyOf(actionnames)
                              .Restrict("id").ValidInteger
                              .DefaultForAction().Is("view"));

                    rules.Add(new PatternRoute(areaname + "+/guid/action", "<area>/<controller>/<id>/[action]")
                              .Restrict("area").AnyOf(new [] { areaname })
                              .Restrict("controller").AnyOf(controllernames)
                              .Restrict("action").AnyOf(actionnames)
                              .Restrict("id").ValidGuid
                              .DefaultForAction().Is("view"));

                    rules.Add(new PatternRoute(areaname + "+/areaid/action", "<area>/<areaid>/<controller>/[action]")
                              .DefaultForArea().Is(areaname)
                              .Restrict("area").AnyOf(new [] { areaname })
                              .Restrict("controller").AnyOf(controllernames)
                              .Restrict("areaid").ValidInteger
                              .Restrict("action").AnyOf(actionnames)
                              .DefaultForAction().Is("index"));

                    rules.Add(new PatternRoute(areaname + "+/areaid/id/action", "<area>/<areaid>/<controller>/<id>/[action]")
                              .DefaultForArea().Is(areaname)
                              .Restrict("area").AnyOf(new [] { areaname })
                              .Restrict("controller").AnyOf(controllernames)
                              .Restrict("areaid").ValidInteger
                              .Restrict("action").AnyOf(actionnames)
                              .Restrict("id").ValidInteger
                              .DefaultForAction().Is("view"));

                    rules.Add(new PatternRoute(areaname + "+/areaid/guid/action", "<area>/<areaid>/<controller>/<id>/[action]")
                              .DefaultForArea().Is(areaname)
                              .Restrict("area").AnyOf(new [] { areaname })
                              .Restrict("controller").AnyOf(controllernames)
                              .Restrict("areaid").ValidInteger
                              .Restrict("action").AnyOf(actionnames)
                              .Restrict("id").ValidGuid
                              .DefaultForAction().Is("view"));
                }
            }
        }
Ejemplo n.º 11
0
 public static void RegisterRoutes(IRoutingRuleContainer engine)
 {
     engine.Add(new PatternRoute("/<controller>/[action]/[id]")
                .DefaultForAction().Is("index")
                .DefaultFor("id").Is(""));
 }
Ejemplo n.º 12
0
 public static void Register(IRoutingRuleContainer rules)
 {
     rules.Add(new PatternRoute("home_default", "/").DefaultForArea().IsEmpty.DefaultForController().Is("home").DefaultForAction().Is("default"));
 }