Exemple #1
0
        public static NavigationRouteBuilder MapNavigationRoute <T>(this RouteCollection routes, string displayName, Expression <Func <T, ActionResult> > action, string areaName = "") where T : IController
        {
            var newRoute = new NamedRoute("", "", new MvcRouteHandler());

            newRoute.ToDefaultAction(action, areaName);
            newRoute.DisplayName = displayName;
            routes.Add(newRoute.Name, newRoute);
            return(new NavigationRouteBuilder(routes, newRoute));
        }
Exemple #2
0
        public static NavigationRouteBuilder AddChildRoute <T>(this NavigationRouteBuilder builder, string DisplayText, Expression <Func <T, ActionResult> > action, string areaName = "") where T : IController
        {
            var childRoute = new NamedRoute("", "", new MvcRouteHandler());

            childRoute.ToDefaultAction <T>(action, areaName);
            childRoute.DisplayName = DisplayText;
            childRoute.IsChild     = true;
            builder._parent.Children.Add(childRoute);
            builder._routes.Add(childRoute.Name, childRoute);
            return(builder);
        }