/// <summary>
        /// Register the area routes.
        /// </summary>
        public override void RegisterArea(AreaRegistrationContext context)
        {
            IRouteRegistrationService routeRegistration = DependencyResolver.Current.GetService <IRouteRegistrationService>();


            // Routes for the history example
            routeRegistration.MapRoute(context, "Example_history_route_path",
                                       "Example/{controller}/History/{jobseekerId}/{contractId}",
                                       new { jobseekerId = UrlParameter.Optional, contractId = UrlParameter.Optional, action = "History", area = "Example" })
            ;    //.SetRouteName("Example_history_route_path");

            // Routes for the dynamic link example
            routeRegistration.MapRoute(context, "Example_parameter_route_path",
                                       "Example/{controller}/{action}/{FirstParameter}/{SecondParameter}",
                                       new { first = UrlParameter.Optional, second = UrlParameter.Optional, area = "Example" });
            routeRegistration.MapRoute(context, "Example_parameter_route_argument",
                                       "Example/{controller}/{action}",
                                       new { area = "Example" });

            // TODO: comment this
            routeRegistration.MapRoute(context,
                                       "Example_inline_button_edit",
                                       "Example/Grid/{action}/{HashKey}",
                                       new { area = "Example", controller = "Grid", action = "Index", HashKey = UrlParameter.Optional }
                                       );

            // Default route
            routeRegistration.MapRoute(context,
                                       "Example_default",
                                       "Example/{controller}/{action}/{id}",
                                       new { area = "Example", controller = "Default", action = "Index", id = UrlParameter.Optional }
                                       );

            // Default route for a fake area
            routeRegistration.MapRoute(context,
                                       "Fake_default",
                                       "Fake/{controller}/{action}/{id}",
                                       new { area = "Fake", controller = "Default", action = "FakeArea", id = UrlParameter.Optional }
                                       );//.SetRouteName("Fake_default");


            // Widget registration
            string[] exampleContexts = new string[] { "Example", "Single widget example" };
            string[] dashboardOnly   = new string[] { "Example" };

            WidgetViewModel.RegisterWidget(new WidgetViewModel("Unique title for the widget", "PowerComponents", "WidgetContentOne"), exampleContexts);
            WidgetViewModel.RegisterWidget(new WidgetViewModel("Writing implement preferences", "PowerComponents", "WidgetContentTwo"), exampleContexts);
            WidgetViewModel.RegisterWidget(new WidgetViewModel("Wide widget", "Example", "PowerComponents", "WidgetContentThree", GroupRowType.Full), exampleContexts);
            WidgetViewModel.RegisterWidget(new WidgetViewModel("Labour Market", "Example", "PowerComponents", "WidgetContentFour"), exampleContexts);
            WidgetViewModel.RegisterWidget(new WidgetViewModel("Duplicate widget", "Example", "PowerComponents", "WidgetContentOne"), dashboardOnly);
            WidgetViewModel.RegisterWidget(new WidgetViewModel("Data context example", "Example", "PowerComponents", "WidgetContentFive"), exampleContexts);

            // Context component registration
            ContextComponentAttribute.RegisteredRenderers.Add(TextComponentKey, (html, model) => { return(TextContextComponent(html, model)); });
            ContextComponentAttribute.RegisteredRenderers.Add(GraphComponentKey, (html, model) => { return(GraphContextComponent(html, model)); });
        }
        /// <summary>
        /// Register the area routes.
        /// </summary>
        public override void RegisterArea(AreaRegistrationContext context)
        {
            IRouteRegistrationService routeRegistration = DependencyResolver.Current.GetService <IRouteRegistrationService>();

            routeRegistration.MapRoute(context,
                                       "Provider_default",
                                       "Provider/{controller}/{action}/{id}",
                                       new { area = AreaName, controller = "Provider", action = "Index", id = UrlParameter.Optional }
                                       );
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Register areas.
        /// </summary>
        public void Register()
        {
            System.Web.Mvc.AreaRegistration.RegisterAllAreas();

            IRouteRegistrationService routeRegistration = DependencyResolver.Current.GetService <IRouteRegistrationService>();

            var validRegisteredRoutes = routeRegistration.GetRoutes();

            foreach (var route in RouteTable.Routes)
            {
                var rt = route as Route;
                if (rt != null)
                {
                    if (!validRegisteredRoutes.Contains(rt))
                    {
                        throw new Exception("Route '" + rt.Url + "' is not registered with IRouteRegistrationService.");
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Register the area routes.
        /// </summary>
        public override void RegisterArea(AreaRegistrationContext context)
        {
            IRouteRegistrationService routeRegistration = DependencyResolver.Current.GetService <IRouteRegistrationService>();



            //context.MapRoute("Adm_AdwLookup_default", "Adm/AdwLookup", new { area = "Admin", controller = "AdwLookup", action = "ListCodeType"});

            //context.MapRoute("Admin_AdwLookup_default", "Admin/AdwLookup/", new { area = "Admin", controller = "AdwLookup", action = "ListCodeType" });


            routeRegistration.MapRoute(context, "Admin_Elmah", "Admin/Elmah/{resource}", new { area = "Admin", controller = "Elmah", action = "Index", resource = UrlParameter.Optional });

            routeRegistration.MapRoute(context, "Admin_Elmah_Index", "Admin/Elmah/Index/{resource}", new { area = "Admin", controller = "Elmah", action = "Index", resource = UrlParameter.Optional });



            //context.MapRoute("Adm_default", "Adm/{controller}/{action}/{id}", new { area = "Admin", controller = "Default", action = "Index", id = UrlParameter.Optional });
            routeRegistration.MapRoute(context, "Admin_default", "Admin/{controller}/{action}/{id}", new { area = "Admin", controller = "Default", action = "Index", id = UrlParameter.Optional });
        }