示例#1
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Tameion.Auctions.Public.AuctionsController",
                "Auctions/{action}/{id}",
                new { area = "Public", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Public.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.Auctions.Vendor.AuctionsController",
                "Vendor/Auctions/{action}/{id}",
                new { area = "Vendor", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.Auctions.Admin.AuctionsController",
                "Admin/Auctions/{action}/{id}",
                new { area = "Admin", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Admin.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
示例#2
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Tameion.Auctions.Public.AuctionsController",
                                        "Auctions/{action}/{id}",
                                        new { area = "Public", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                                        new[] { "Nop.Plugin.Tameion.Auctions.Areas.Public.Controllers" }
                                        );

            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.Auctions.Vendor.AuctionsController",
                                    "Vendor/Auctions/{action}/{id}",
                                    new { area = "Vendor", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                                    new[] { "Nop.Plugin.Tameion.Auctions.Areas.Vendor.Controllers" }
                                    );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.Auctions.Admin.AuctionsController",
                                    "Admin/Auctions/{action}/{id}",
                                    new { area = "Admin", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                                    new[] { "Nop.Plugin.Tameion.Auctions.Areas.Admin.Controllers" }
                                    );
            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
示例#3
0
        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Add(new CustomViewEngine());
            var routeArticleGroupAdmin = routes.MapRoute("Plugin.Misc.Articles.ArticleGroup.Admin",
                "Admin/ArticleGroup/{action}/{id}",
                new { controller = "ArticleGroup", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Articles.Controllers" }
                );
            routeArticleGroupAdmin.DataTokens.Add("area", "admin");
            routes.Remove(routeArticleGroupAdmin);
            routes.Insert(0, routeArticleGroupAdmin);

            var routeArticleAdmin = routes.MapRoute("Plugin.Misc.Articles.Article.Admin",
                "Admin/Article/{action}/{id}",
                new { controller = "Article", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Articles.Controllers" }
                );
            routeArticleAdmin.DataTokens.Add("area", "admin");
            routes.Remove(routeArticleAdmin);
            routes.Insert(0, routeArticleAdmin);
            //routes.MapRoute("ArticleAdmin",
            //      "Admin/Plugins/ArticleManagement/ArticleAdmin/{action}/{id}",
            //      new { controller = "ArticleAdmin", action = "Index", id = UrlParameter.Optional },
            //      new[] { "Nop.Plugin.Other.ArticleManagement.Controllers" }
            // ).DataTokens.Add("area", "admin"); ;
        }
示例#4
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var routeCategory = routes.MapRoute(
                "Nop.Plugin.Affiliate.ProductMapping.LoadUrl",
                "admin/ProductMapping/LoadUrl",
                new { controller = "ProductMapping", action = "LoadUrl" },
                new[] { "Nop.Plugin.Affiliate.CategoryMap.Controllers" });

            routes.Remove(routeCategory);
            routes.Insert(0, routeCategory);

            var routeShipping = routes.MapRoute(
                "Nop.Plugin.Affiliate.ProductMapping.LoadShippingDescription",
                "ProductMapping/LoadShippingDescription",
                new { controller = "ProductMapping", action = "LoadShippingDescription" },
                new[] { "Nop.Plugin.Affiliate.CategoryMap.Controllers" });

            routes.Remove(routeShipping);
            routes.Insert(0, routeShipping);

            var routeUpdatePrice = routes.MapRoute(
                "Nop.Plugin.Affiliate.ProductMapping.UpdatePrice",
                "admin/ProductMapping/UpdatePrice",
                new { controller = "ProductMapping", action = "UpdatePrice" },
                new[] { "Nop.Plugin.Affiliate.CategoryMap.Controllers" });

            routes.Remove(routeUpdatePrice);
            routes.Insert(0, routeUpdatePrice);
        }
示例#5
0
        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Insert(0, new PluginViewEngine());
            //contact us example

            var route = routes.MapRoute("ContactUsCustom", "contactus",
                                        new { controller = "ContactUs", action = "ContactUs" },
                                        namespaces: new[] { "Nop.Plugins.MyStore.Controllers" }
                                        );

            routes.Remove(route);
            routes.Insert(0, route);



            route = routes.MapRoute("ProductExtendedFields",
                                    "Admin/Category/ProductExtendedFields/{productId}",
                                    new { controller = "ExtendedFields", action = "ProductExtendedFields" },
                                    new[] { "Nop.Plugins.MyStore.Controllers" }
                                    );

            route.DataTokens.Add("area", "admin");
            routes.Remove(route);
            routes.Insert(0, route);
        }
示例#6
0
        static void InstallRoutes(RouteCollection routes)
        {
            var assetRoute = new Route("_instantcss/assets/{*path}", new AssetRouteHandler());
            routes.Insert(0, assetRoute);

            var connectionRoute = routes.MapConnection<ExpressCssConnection>("ExpressCss", "_instantcss/connection/{*operation}");
            routes.Remove(connectionRoute);
            routes.Insert(1, connectionRoute);
        }
示例#7
0
        /// <summary>
        /// Registers the routes.
        /// </summary>
        /// <param name="routeCollection">The route collection.</param>
        public static void RegisterRoutes(RouteCollection routeCollection)
        {
            List <RouteBase> routes = new List <RouteBase> {
                new Route("sitemap.xml",
                          new RouteValueDictionary(
                              new { controller = "XmlSiteMap", action = "Index", page = 0 }),
                          new MvcRouteHandler()),

                new Route("sitemap-{page}.xml",
                          new RouteValueDictionary(
                              new { controller = "XmlSiteMap", action = "Index", page = 0 }),
                          new MvcRouteHandler())
            };

            if (routeCollection.Count == 0)
            {
                foreach (var route in routes)
                {
                    routeCollection.Add(route);
                }
            }
            else
            {
                foreach (var route in routes)
                {
                    routeCollection.Insert(routeCollection.Count - 1, route);
                }
            }
        }
        /// <summary>
        /// Registers the routes.
        /// </summary>
        /// <param name="routeCollection">The route collection.</param>
        public static void RegisterRoutes(RouteCollection routeCollection)
        {
            List<RouteBase> routes = new List<RouteBase> {
                new Route("sitemap.xml",
                    new RouteValueDictionary(
                        new { controller = "XmlSiteMap", action = "Index", page = 0 }),
                            new MvcRouteHandler()),

                new Route("sitemap-{page}.xml",
                    new RouteValueDictionary(
                        new { controller = "XmlSiteMap", action = "Index", page = 0 }),
                            new MvcRouteHandler())
            };

            if (routeCollection.Count == 0)
            {
                foreach (var route in routes)
                {
                    routeCollection.Add(route);
                }
            }
            else
            {
                foreach (var route in routes)
                {
                    routeCollection.Insert(routeCollection.Count - 1, route);
                }
            }
        }
        private static void InitializeDynamicData(RouteCollection routes, string root, IConfiguration configuration)
        {
            try
            {
                DefaultModel.RegisterContext(
                    new EFCodeFirstDataModelProvider(
                        () => new EntitiesContext(configuration.SqlConnectionString, readOnly: false)), // DB Admins do not need to respect read-only mode.
                    configuration: new ContextConfiguration {
                    ScaffoldAllTables = true
                });
            }
            catch (SqlException e)
            {
                QuietlyLogException(e);
                return;
            }
            catch (DataException e)
            {
                QuietlyLogException(e);
                return;
            }

            // This route must come first to prevent some other route from the site to take over
            _route = new DynamicDataRoute(root + "/{table}/{action}")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model       = DefaultModel
            };
            routes.Insert(0, _route);

            routes.MapPageRoute(
                "dd_default",
                root,
                "~/Areas/Admin/DynamicData/Default.aspx");
        }
示例#10
0
        private static void InitializeDynamicData(RouteCollection routes, string root, IAppConfiguration configuration)
        {
            try
            {
                DefaultModel.RegisterContext(
                    new EFCodeFirstDataModelProvider(
                        () => new EntitiesContext(configuration.SqlConnectionString, readOnly: false)), // DB Admins do not need to respect read-only mode.
                        configuration: new ContextConfiguration { ScaffoldAllTables = true });
            }
            catch (SqlException e)
            {
                QuietLog.LogHandledException(e);
                return;
            }
            catch (DataException e)
            {
                QuietLog.LogHandledException(e);
                return;
            }

            // This route must come first to prevent some other route from the site to take over
            _route = new DynamicDataRoute(root + "/{table}/{action}")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model = DefaultModel
            };
            routes.Insert(0, _route);

            routes.MapPageRoute(
                "dd_default",
                root,
                "~/Areas/Admin/DynamicData/Default.aspx");
        }
示例#11
0
 public static void Insert(IEnumerable <RouteBase> routes)
 {
     foreach (var route in routes)
     {
         _routes.Insert(2, route);
     }
 }
        private static IContentRoute MapCategoryRoute(this RouteCollection routes, string insertAfterRouteName, string name, string url, object defaults, Func<SiteDefinition, ContentReference> contentRootResolver)
        {
            var basePathResolver = ServiceLocator.Current.GetInstance<IBasePathResolver>();
            var urlSegmentRouter = ServiceLocator.Current.GetInstance<IUrlSegmentRouter>();
            var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
            urlSegmentRouter.RootResolver = contentRootResolver;
            Func<RequestContext, RouteValueDictionary, string> resolver = basePathResolver.Resolve;

            var contentRouteParameters = new MapContentRouteParameters
            {
                UrlSegmentRouter = urlSegmentRouter,
                BasePathResolver = resolver,
                Direction = SupportedDirection.Both,
                Constraints = new { node = new ContentTypeConstraint<CategoryData>(contentLoader) }
            };

            RouteBase mediaRoute = RouteTable.Routes[insertAfterRouteName];
            int insertIndex = mediaRoute != null
                ? RouteTable.Routes.IndexOf(mediaRoute) + 1
                : RouteTable.Routes.Count;

            var route = routes.MapContentRoute(name, url, defaults, contentRouteParameters) as DefaultContentRoute;
            routes.Remove(route);
            routes.Insert(insertIndex, route);
            return route;
        }
示例#13
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var routeList = routes.MapRoute(
                "Nop.Plugin.Worldbuy.StateProvinceWB.List",
                "admin/StateProvinceWB/List",
                new { controller = "StateProvinceWB", action = "List" },
                new[] { "Nop.Plugin.Worldbuy.StateProvinceWB.Controllers" });

            routes.Remove(routeList);
            routes.Insert(0, routeList);

            var routeRead = routes.MapRoute(
                "Nop.Plugin.Worldbuy.StateProvinceWB.Read",
                "admin/StateProvinceWB/Read",
                new { controller = "StateProvinceWB", action = "Read" },
                new[] { "Nop.Plugin.Worldbuy.StateProvinceWB.Controllers" });

            routes.Remove(routeRead);
            routes.Insert(0, routeRead);

            var routeUpdate = routes.MapRoute(
                "Nop.Plugin.Worldbuy.StateProvinceWB.Update",
                "admin/StateProvinceWB/Update",
                new { controller = "StateProvinceWB", action = "Update" },
                new[] { "Nop.Plugin.Worldbuy.StateProvinceWB.Controllers" });

            routes.Remove(routeUpdate);
            routes.Insert(0, routeUpdate);

            var routeDelete = routes.MapRoute(
                "Nop.Plugin.Worldbuy.StateProvinceWB.Delete",
                "admin/StateProvinceWB/Delete",
                new { controller = "StateProvinceWB", action = "Delete" },
                new[] { "Nop.Plugin.Worldbuy.StateProvinceWB.Controllers" });

            routes.Remove(routeDelete);
            routes.Insert(0, routeDelete);

            var routeSync = routes.MapRoute(
                "Nop.Plugin.Worldbuy.StateProvinceWB.ImportFromXlsx",
                "admin/StateProvinceWB/ImportFromXlsx",
                new { controller = "StateProvinceWB", action = "ImportFromXlsx" },
                new[] { "Nop.Plugin.Worldbuy.StateProvinceWB.Controllers" });

            routes.Remove(routeSync);
            routes.Insert(0, routeSync);
        }
        public static Route MapDefault(this RouteCollection routes)
        {
            var route = MapRoute(routes, "default", "{*url}", null, null, null);

            routes.Remove(route);
            routes.Insert(0, route);
            return(route);
        }
        public virtual void RegisterArea(RouteCollection routes, ViewEngineCollection viewEngines, IEngine engine)
        {
            var route = new ContentRoute<IManagementHomePart>(engine);
            routes.Insert(0, route);

            var viewLocationFormats = new[] { Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/{1}/{0}.ascx"), Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/Shared/{0}.ascx") };
            viewEngines.Insert(0, new PrivateViewEngineDecorator(new WebFormViewEngine { AreaViewLocationFormats = viewLocationFormats, PartialViewLocationFormats = viewLocationFormats }, route));
        }
示例#16
0
 static void InstallRoute(RouteCollection routes)
 {
     var route = new CassetteRoute(
         "_cassette/jasmine/{*specbundle}",
         new DelegateRouteHandler(context => new PageHandler(context))
     );
     routes.Insert(0, route);
 }
示例#17
0
        static void InstallRoute(RouteCollection routes)
        {
            var route = new CassetteRoute(
                "_cassette/jasmine/{*specbundle}",
                new DelegateRouteHandler(context => new PageHandler(context))
                );

            routes.Insert(0, route);
        }
示例#18
0
        void InstallHudRoute(RouteCollection routes)
        {
            var route = new CassetteRoute(
                RoutePrefix,
                new DelegateRouteHandler(context => new HudRequestHandler(() => (CassetteApplication)CassetteApplicationContainer.Instance.Application, context))
                );

            routes.Insert(0, route);
        }
示例#19
0
        }         // constructor

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");

            routes.MapRoute(
                "EmailChanged",                 // Route name
                "emailchanged/{code}",          // URL with parameters
                new {
                controller = "ConfirmEmail",
                action     = "EmailChanged"
            }                     // Parameter defaults
                );

            routes.MapRoute(
                "EmailConfirmation",              // Route name
                "confirm/{code}",                 // URL with parameters
                new {
                controller = "ConfirmEmail",
                action     = "Index"
            }                     // Parameter defaults
                );

            routes.MapRoute(
                "Default",                    // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new {
                controller = "Home",
                action     = "Index",
                id         = UrlParameter.Optional
            }                     // Parameter defaults
                );

            routes.Insert(0, new Route("pie.htc", new RouteValueDictionary(new {
                controller = "Pie",
                action     = "Index"
            }), new MvcRouteHandler()));
            routes.Insert(0, new Route("{area}/pie.htc", new RouteValueDictionary(new {
                controller = "Pie",
                action     = "Index",
                area       = ""
            }), new MvcRouteHandler()));
            //routes.MapRoute(null, "{Area}/{c}/{a}/pie.htc", new {controller = "Pie", action = "Index", c = "", a="", Area=""});
        }
示例#20
0
        /// <summary>
        /// Looks for a GUID at the start of the route and resolves it to its correct Sitecore path.
        /// </summary>
        /// <param name="routes"></param>
        private static void ResolveSitecoreRoutePaths(RouteCollection routes)
        {
            var ignorePaths = new List <string>();

            foreach (Route route in routes)
            {
                if (!route.Url.StartsWith("{"))
                {
                    continue;
                }

                var elements = route.Url.Split('/');

                if (elements.Length == 0)
                {
                    continue;
                }

                Guid guid;

                if (!Guid.TryParse(elements[0], out guid))
                {
                    continue;
                }

                var pathItem = Sitecore.Context.Database.GetItem(guid.ToString());

                if (pathItem != null)
                {
                    var options = UrlOptions.DefaultOptions;
                    options.AddAspxExtension  = false;
                    options.LanguageEmbedding = LanguageEmbedding.Never;
                    var path = LinkManager.GetItemUrl(pathItem, options).TrimStart('/');
                    route.Url = route.Url.Replace(elements[0], path);

                    path = path + "/";

                    if (!ignorePaths.Contains(path))
                    {
                        ignorePaths.Add(path);
                    }
                }
            }

            var addIgnore = Sitecore.Configuration.Settings.GetSetting("MvcRouting.AddBaseIgnoreForRoutes");

            if (!string.IsNullOrEmpty(addIgnore) && addIgnore == "true")
            {
                foreach (var ignorePath in ignorePaths)
                {
                    routes.Insert(0, new Route(ignorePath, new StopRoutingHandler()));
                }
            }
        }
        //public IAppBuilder _appBuilderService { get; set; }
        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Add(new CustomViewEngine());
            RouteBase r = routes.MapRoute("DevPartner.Nop.Plugin.Misc.StartedKit.SubscribeToTheNewsletter",
                                          "DPStartedKit/SubscribeToTheNewsletter",
                                          new { controller = "DPStartedKit", action = "SubscribeToTheNewsletter" },
                                          new[] { "DevPartner.Nop.Plugin.Misc.StartedKit.Controllers" });

            routes.Remove(r);
            routes.Insert(0, r);
        }
示例#22
0
        public static void AddStaticRoute(this RouteCollection routes, StaticRoute sroute, bool needsLock = false)
        {
            var route = new Route(sroute.StaticRouteUrl, new MvcRouteHandler())
            {
                Defaults = new RouteValueDictionary(new
                {
                    controller = sroute.Area,
                    action     = sroute.Action,
                    id         = sroute.Id,
                }),
                Constraints = new RouteValueDictionary(new
                {
                    controller = new IsAjaxConstraint()
                })
            };

            var staticRoute = new Route(sroute.StaticRouteUrl, new MvcRouteHandler())
            {
                Defaults = new RouteValueDictionary(new
                {
                    controller = "Home",
                    action     = "StaticRoute",
                    type       = sroute.Action,
                    id         = sroute.Id
                })
            };

            if (needsLock)
            {
                using (routes.GetWriteLock())
                {
                    routes.Insert(0, staticRoute);
                    routes.Insert(0, route);
                }
            }
            else
            {
                routes.Insert(0, staticRoute);
                routes.Insert(0, route);
            }
        }
        public virtual void RegisterArea(RouteCollection routes, ViewEngineCollection viewEngines, IEngine engine)
        {
            var route = new ContentRoute <IManagementHomePart>(engine);

            routes.Insert(0, route);

            var viewLocationFormats = new[] { Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/{1}/{0}.ascx"), Url.ResolveTokens("{ManagementUrl}/Myself/Analytics/Views/Shared/{0}.ascx") };

            viewEngines.Insert(0, new PrivateViewEngineDecorator(new WebFormViewEngine {
                AreaViewLocationFormats = viewLocationFormats, PartialViewLocationFormats = viewLocationFormats
            }, route));
        }
示例#24
0
 public static void InsertRouteAfter(this RouteCollection routes, string existingRouteName, RouteBase newRoute)
 {
     if (routes[existingRouteName] != null)
     {
         int index = routes.IndexOf(routes[existingRouteName]);
         routes.Insert(index, newRoute);
     }
     else
     {
         throw new Exception("InsertRouteAfter: Route not found [" + existingRouteName + "]");
     }
 }
示例#25
0
 public void RegisterRoutes(RouteCollection routes)
 {
     var route = routes.MapRoute("Plugin.Tameion.Jobs.JobsController",
         "Jobs/{action}/{id}",
         new { controller = "Jobs", action = "Index", id = UrlParameter.Optional },
         new[] { "Nop.Plugin.Tameion.Jobs.Controllers" }
     );
     routes.Remove(route);
     routes.Insert(0, route);
     
     ViewEngines.Engines.Insert(0, new CustomViewEngine());
 }
示例#26
0
        void InstallRawFileRoute(RouteCollection routes)
        {
            const string url     = RoutePrefix + "/file/{*path}";
            var          handler = new DelegateRouteHandler(
                requestContext => new RawFileRequestHandler(requestContext)
                );

            Trace.Source.TraceInformation("Installing raw file route handler for \"{0}\".", url);
            // Insert Cassette's routes at the start of the table,
            // to avoid conflicts with the application's own routes.
            routes.Insert(0, new CassetteRoute(url, handler));
        }
示例#27
0
 public void RegisterRoutes(RouteCollection routes)
 {
     var route = routes.MapRoute("Plugin.Tameion.SelectAndSell.SelectSellController",
         "Vendor/SelectSell/{action}/{id}",
         new { area = "Vendor", controller = "SelectSell", action = "Index", id = UrlParameter.Optional },
         new[] { "Nop.Plugin.Tameion.SelectAndSell.Controllers" }
     );
     routes.Remove(route);
     routes.Insert(0, route);
     
     //ViewEngines.Engines.Insert(0, new CustomViewEngine());
 }
		/// <summary>
		/// Used in Gloabal.asax to setup this CacheManager to handle paths where the RouteOptions.BasePath
		/// leading directory is used to distinguish the paths
		/// </summary>
		/// <param name="routes"></param>
		/// <param name="opts"></param>
		public static void RegisterDefault(RouteCollection routes, CachingOptions opts = null)
		{
			opts = opts ?? new CachingOptions();

			var path = string.Format("{0}/{{hash}}/{{type}}/{{*path}}", opts.BasePath);

			var mgr = new CacheManager(LoadAssets(opts.CacheFile), opts);

			routes.Insert(0, new Route(path, new CacheHandler(mgr)));

			Instance = mgr;
		}
示例#29
0
 public void RegisterRoutes(RouteCollection routes)
 {
     var route = routes.MapRoute("Plugin.Tameion.AffiliateSystem.AffiliatesController",
         "Affiliates/{action}/{id}",
         new { area = "Admin", controller = "Affiliates", action = "Index", id = UrlParameter.Optional },
         new[] { "Nop.Plugin.Tameion.AffiliateSystem.Controllers" }
     );
     routes.Remove(route);
     routes.Insert(0, route);
     
     ViewEngines.Engines.Insert(0, new CustomViewEngine());
 }
示例#30
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Misc.Advertisements.AdvertisementsController",
                "Admin/Ads/{action}/{id}",
                new { area = "Admin", controller = "Advertisements", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Misc.Advertisements.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
示例#31
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Tameion.SelectAndSell.SelectSellController",
                                        "Vendor/SelectSell/{action}/{id}",
                                        new { area = "Vendor", controller = "SelectSell", action = "Index", id = UrlParameter.Optional },
                                        new[] { "Nop.Plugin.Tameion.SelectAndSell.Controllers" }
                                        );

            routes.Remove(route);
            routes.Insert(0, route);

            //ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
        /// <summary>
        /// Map route for a page controller.
        /// As this is called after the global DXA initialization we have to shuffle around the route definition so it comes before the DXA page controller.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="name"></param>
        /// <param name="url"></param>
        /// <param name="defaults"></param>
        protected static void MapRoute(RouteCollection routes, string name, string url, object defaults)
        {
            Route route = new Route(url, new MvcRouteHandler())
            {
                Defaults   = CreateRouteValueDictionary(defaults),
                DataTokens = new RouteValueDictionary()
                {
                    { "Namespaces", NAMESPACE }
                }
            };

            routes.Insert(0, route);
        }
示例#33
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Tameion.AffiliateSystem.AffiliatesController",
                                        "Affiliates/{action}/{id}",
                                        new { area = "Admin", controller = "Affiliates", action = "Index", id = UrlParameter.Optional },
                                        new[] { "Nop.Plugin.Tameion.AffiliateSystem.Controllers" }
                                        );

            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
        /// <summary>Maps a content route to the route collection.</summary>
        /// <param name="routes">The route collection to extend.</param>
        /// <param name="name">The name of this route.</param>
        /// <param name="engine">The N2 Engine instance used by the content route.</param>
        /// <returns>The added content route instance.</returns>
        public static ContentRoute MapContentRoute(this RouteCollection routes, string name, IEngine engine)
        {
            var nonContentRoutes = SelectRoutesWithIndices(routes)
                                   .Where(x => !(x.Value is ContentRoute));
            int indexOfFirstNonContentRoute = nonContentRoutes.Any()
                                ? nonContentRoutes.Select(i => i.Key).FirstOrDefault()
                                : routes.Count;

            var cr = new ContentRoute(engine);

            routes.Insert(indexOfFirstNonContentRoute, cr);
            return(cr);
        }
示例#35
0
        void InstallBundleRoute <T>(RouteCollection routes, Func <IBundleContainer> getBundleContainer)
            where T : Bundle
        {
            var url     = GetBundleRouteUrl <T>();
            var handler = new DelegateRouteHandler(
                requestContext => new BundleRequestHandler <T>(getBundleContainer, requestContext)
                );

            Trace.Source.TraceInformation("Installing {0} route handler for \"{1}\".", typeof(T).FullName, url);
            // Insert Cassette's routes at the start of the table,
            // to avoid conflicts with the application's own routes.
            routes.Insert(0, new CassetteRoute(url, handler));
        }
示例#36
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Tameion.Jobs.JobsController",
                                        "Jobs/{action}/{id}",
                                        new { controller = "Jobs", action = "Index", id = UrlParameter.Optional },
                                        new[] { "Nop.Plugin.Tameion.Jobs.Controllers" }
                                        );

            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
        /// <summary>Maps a content route to the route collection.</summary>
        /// <param name="routes">The route collection to extend.</param>
        /// <param name="name">The name of this route.</param>
        /// <param name="engine">The N2 Engine instance used by the content route.</param>
        /// <typeparam name="T">The type of content items to route.</typeparam>
        /// <returns>The added content route instance.</returns>
        public static ContentRoute MapContentRoute <T>(this RouteCollection routes, string name, IEngine engine)
        {
            var nonContentRoutesNorGenericRoutes = SelectRoutesWithIndices(routes)
                                                   .Where(x => !(x.Value is ContentRoute) || !x.Value.GetType().ContainsGenericParameters);
            int indexOfFirstNonContentRoute = nonContentRoutesNorGenericRoutes.Any()
                                ? nonContentRoutesNorGenericRoutes.Select(i => i.Key).FirstOrDefault()
                                : routes.Count;

            var cr = new ContentRoute <T>(engine);

            routes.Insert(indexOfFirstNonContentRoute, cr);
            return(cr);
        }
示例#38
0
        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Insert(0, new PluginViewEngine());
            //contact us example

               var  route = routes.MapRoute("ContactUsCustom","contactus",
            new { controller = "ContactUs", action = "ContactUs" },
            namespaces: new[] { "Nop.Plugins.MyStore.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

              route = routes.MapRoute("ProductExtendedFields",
              "Admin/Category/ProductExtendedFields/{productId}",
              new { controller = "ExtendedFields", action = "ProductExtendedFields" },
              new[] { "Nop.Plugins.MyStore.Controllers" }
              );

            route.DataTokens.Add("area", "admin");
            routes.Remove(route);
            routes.Insert(0, route);
        }
示例#39
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Misc.Advertisements.AdvertisementsController",
                                        "Admin/Ads/{action}/{id}",
                                        new { area = "Admin", controller = "Advertisements", action = "Index", id = UrlParameter.Optional },
                                        new[] { "Nop.Plugin.Misc.Advertisements.Controllers" }
                                        );

            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
示例#40
0
        private static void AddErrorRoute(RouteCollection routes)
        {
            // To allow IIS to execute "/notfound" when requesting something which is disallowed,
            // such as /bin or /add_data.
            var route = new Route(
                "error",
                new RouteValueDictionary(new { controller = GlobalErrorConfig.CustomData.ErrorControllerName, action = GlobalErrorConfig.CustomData.ErrorActionName }),
                new RouteValueDictionary(new { incoming = new IncomingRequestRouteConstraint() }),
                new MvcRouteHandler());

            // Insert at start of route table. This means the application can still create another route like "{name}" that won't capture "/notfound".
            routes.Insert(0, route);
        }
        public void RegisterRoutes(RouteCollection routes)
        {
            var routek = routes.MapRoute("Nop.Plugin.Widgets.PriceForSize",
                                         "admin/plugins/priceforsize/{action}/{Id}",
                                         new { controller = "WidgetsPriceForSize", action = "AdminProduct", Id = UrlParameter.Optional },
                                         // new { Id = @"\d+" },
                                         new[] { "Nop.Plugin.Widgets.PriceForSize.Controllers" }
                                         );

            routek.DataTokens.Add("area", "admin");
            routes.Remove(routek);
            routes.Insert(0, routek);
        }
示例#42
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var routeList = routes.MapRoute(
                "Nop.Plugin.Order.Amazon.List",
                "admin/OrderAmazon/List",
                new { controller = "OrderAmazon", action = "List" },
                new[] { "Nop.Plugin.Order.Amazon.Controllers" });

            routes.Remove(routeList);
            routes.Insert(0, routeList);

            var routeOrderList = routes.MapRoute(
                "Nop.Plugin.Order.Amazon.OrderList",
                "admin/OrderAmazon/OrderList",
                new { controller = "OrderAmazon", action = "OrderList" },
                new[] { "Nop.Plugin.Order.Amazon.Controllers" });

            routes.Remove(routeOrderList);
            routes.Insert(0, routeOrderList);

            var routeOrder = routes.MapRoute(
                "Nop.Plugin.Order.Amazon.Order",
                "admin/OrderAmazon/Order/{id}",
                new { controller = "OrderAmazon", action = "Order", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Order.Amazon.Controllers" });

            routes.Remove(routeOrder);
            routes.Insert(0, routeOrder);

            var routeCreate = routes.MapRoute(
                "Nop.Plugin.Order.Amazon.CartCreate",
                "admin/OrderAmazon/CartCreate",
                new { controller = "OrderAmazon", action = "CartCreate" },
                new[] { "Nop.Plugin.Order.Amazon.Controllers" });

            routes.Remove(routeCreate);
            routes.Insert(0, routeCreate);
        }
示例#43
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var routeConfigure = routes.MapRoute("Plugin.Affiliate.Ebay.Configure",
                                                 "Admin/AffiliateEbay/Configure",
                                                 new { controller = "AffiliateEbay", action = "Configure" },
                                                 new[] { "Nop.Plugin.Affiliate.Ebay.Controllers" }
                                                 );

            routes.Remove(routeConfigure);
            routes.Insert(0, routeConfigure);

            var routeCallApi = routes.MapRoute("Plugin.Affiliate.Ebay.CallApi",
                                               "Admin/AffiliateEbay/CallApi",
                                               new { controller = "AffiliateEbay", action = "CallApi" },
                                               new[] { "Nop.Plugin.Affiliate.Ebay.Controllers" }
                                               );

            routes.Remove(routeCallApi);
            routes.Insert(0, routeCallApi);

            var routeMapCategory = routes.MapRoute("Plugin.Affiliate.Ebay.MapCategory",
                                                   "Admin/AffiliateEbay/MapCategory",
                                                   new { controller = "AffiliateEbay", action = "MapCategory" },
                                                   new[] { "Nop.Plugin.Affiliate.Ebay.Controllers" }
                                                   );

            routes.Remove(routeMapCategory);
            routes.Insert(0, routeMapCategory);

            var test = routes.MapRoute("Plugin.Affiliate.Ebay.ConvertPrice",
                                       "Admin/AffiliateEbay/ConvertPrice",
                                       new { controller = "AffiliateEbay", action = "ConvertPrice" },
                                       new[] { "Nop.Plugin.Affiliate.Ebay.Controllers" }
                                       );

            routes.Remove(test);
            routes.Insert(0, test);
        }
示例#44
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            using (routes.GetWriteLock())
            {
                routes.Insert(
                    0,
                    new Route(
                        CacheTagMvcSettings.RouteUrl,
                        new RouteValueDictionary(new {controller = "CacheTag", action = "Resource"}),
                        new MvcRouteHandler()
                        )
                    );

                routes.Insert(
                    0,
                    new Route(
                        CacheTagMvcSettings.RouteUrl + ".{ext}",
                        new RouteValueDictionary(new { controller = "CacheTag", action = "Resource", ext = UrlParameter.Optional }),
                        new MvcRouteHandler()
                        )
                    );
            }
        }
        void AddNotFoundRoute(RouteCollection routes)
        {
            // To allow IIS to execute "/notfound" when requesting something which is disallowed,
            // such as /bin or /add_data.
            var route = new Route(
                "notfound",
                new RouteValueDictionary(new {controller = "NotFound", action = "NotFound"}),
                new RouteValueDictionary(new {incoming = new IncomingRequestRouteConstraint()}),
                new MvcRouteHandler()
            );

            // Insert at start of route table. This means the application can still create another route like "{name}" that won't capture "/notfound".
            routes.Insert(0, route);
        }
        public void ConfigureEditRoute(RouteCollection routes, string prefix)
        {
            var routeValueDictionary = new RouteValueDictionary
                                           {
                                               {"controller", "ReallyTinyCms"},
                                               {"action", "Index"},
                                               {"name", UrlParameter.Optional}
                                           };

            var route1 = new Route(prefix + "/{action}/{name}", routeValueDictionary, new MvcRouteHandler());
            var route2 = new Route(prefix + "/{action}/{name}", routeValueDictionary, new MvcRouteHandler());

            routes.Add("ReallyTinyCmsAdmin", route1);
            routes.Insert(0, route2);
        }
示例#47
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Tameion.SupportTicketSystem.Areas.Admin.TicketsController",
                "Admin/Tickets/{action}/{id}",
                new { area = "Admin", controller = "Tickets", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.SupportTicketSystem.Areas.Admin.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.SupportTicketSystem.Areas.Vendor.TicketsController",
                "Vendor/Tickets/{action}/{id}",
                new { area = "Vendor", controller = "Tickets", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.SupportTicketSystem.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.SupportTicketSystem.Areas.Admin.RepliesController",
                "Admin/Replies/{action}/{id}",
                new { area = "Admin", controller = "Replies", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.SupportTicketSystem.Areas.Admin.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.SupportTicketSystem.Areas.Vendor.RepliesController",
                "Vendor/Replies/{action}/{id}",
                new { area = "Vendor", controller = "Replies", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.SupportTicketSystem.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);
            
            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
示例#48
0
        public static void Register(RouteCollection routes)
        {
            // This route must come first to prevent some other route from the site to take over
            routes.Insert(0, new DynamicDataRoute("dbadmin/{table}/{action}")
                             {
                                 Constraints = new RouteValueDictionary(new {action = "List|Details|Edit|Insert"}),
                                 Model = DefaultModel
                             });

            routes.MapPageRoute(
                "dd_default",
                "{dbadmin}",
                "~/DynamicData/Default.aspx",
                true,
                new RouteValueDictionary(),
                new RouteValueDictionary {{"dbadmin", "dbadmin"}});
        }
示例#49
0
        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Misc.GroupDeals.Areas.Vendor.GroupDealsController",
                "Vendor/GroupDeals/{action}/{id}",
                new { area = "Vendor", controller = "GroupDeals", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.GroupDeals.Areas.Admin.GroupDealsController",
                "Admin/GroupDeals/{action}/{id}",
                new { area = "Admin", controller = "GroupDeals", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Admin.Controllers" }
            );//.DataTokens.Add("area", "Admin")
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.GroupDeals.Areas.Public.GroupDealsController",
                "GroupDeals/{action}/{id}",
                new { controller = "GroupDeals", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Public.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.GroupDeals.Areas.Public.GdShoppingCartController",
                "GdShoppingCart/{action}",
                new { controller = "GdShoppingCart", action = "Cart" },
                new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Public.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            //add groupdeal to cart (without any attributes and options). used on catalog pages.
            route = routes.MapLocalizedRoute("AddGroupDealToCart-Catalog",
                            "addgroupdealtocart/catalog/{groupDealId}/{shoppingCartTypeId}/{quantity}",
                            new { controller = "GdShoppingCart", action = "AddGroupDealToCart_Catalog" },
                            new { groupDealId = @"\d+", shoppingCartTypeId = @"\d+", quantity = @"\d+" },
                            new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Public.Controllers" });
            routes.Remove(route);
            routes.Insert(0, route);
            //add groupdeal to cart (with attributes and options). used on the groupdeal details pages.
            route = routes.MapLocalizedRoute("AddGroupDealToCart-Details",
                            "addgroupdealtocart/details/{groupDealId}/{shoppingCartTypeId}",
                            new { controller = "GdShoppingCart", action = "AddGroupDealToCart_Details" },
                            new { groupDealId = @"\d+", shoppingCartTypeId = @"\d+" },
                            new[] { "Nop.Plugin.Misc.GroupDeals.Areas.Public.Controllers" });
            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
示例#50
0
        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Add(new CustomViewEngine());

            var lstRoute = new List<Route>();

            lstRoute.Add(routes.MapRoute("Plugin.Misc.DoItYourself.DiyGroup.Admin",
                "Admin/DiyGroup/{action}/{id}",
                new { controller = "DiyGroup", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.DoItYourself.Controllers" }
                ));
            lstRoute.Add(routes.MapRoute("Plugin.Misc.DiyProjectes.DiyProject.Admin",
                "Admin/DiyProject/{action}/{id}",
                new {controller = "DiyProject", action = "Index", id = UrlParameter.Optional},
                new[] {"Toi.Plugin.Misc.DoItYourself.Controllers"}
                ));

            lstRoute.Add(routes.MapRoute("DiyGroup",
                "DiyGroup/{action}/{id}",
                new { controller = "DiyGroupRead", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.DoItYourself.Controllers" }
                ));

            lstRoute.Add(routes.MapRoute("Diy",
                "DIY",
                new { controller = "DiyGroupRead", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.DoItYourself.Controllers" }
                ));

            //lstRoute.Add(routes.MapRoute("DiyGroupNavigation",
            //    "DiyGroupNavigation",
            //    new { controller = "DiyGroup", action = "DiyGroupNavigation", id = UrlParameter.Optional },
            //    new[] { "Toi.Plugin.Misc.DoItYourself.Controllers" }
            //    ));
            foreach (var route in lstRoute)
            {
                routes.Remove(route);
                routes.Insert(0, route);
            }
            //routes.MapRoute("DiyProjectAdmin",
            //      "Admin/Plugins/DiyProjectManagement/DiyProjectAdmin/{action}/{id}",
            //      new { controller = "DiyProjectAdmin", action = "Index", id = UrlParameter.Optional },
            //      new[] { "Nop.Plugin.Other.DiyProjectManagement.Controllers" }
            // ).DataTokens.Add("area", "admin"); ;
        }
示例#51
0
        public static void Register(RouteCollection routes)
        {
            DefaultModel.RegisterContext(
               new EFCodeFirstDataModelProvider(() => new EntitiesContext()),
               new ContextConfiguration() { ScaffoldAllTables = true });

            // This route must come first to prevent some other route from the site to take over
            routes.Insert(0, new DynamicDataRoute("dbadmin/{table}/{action}")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model = DefaultModel
            });

            routes.MapPageRoute(
                "dd_default",
                "dbadmin",
                "~/DynamicData/Default.aspx");
        }
示例#52
0
        public static void Register(RouteCollection routes)
        {
            DefaultModel.RegisterContext(
                () => ((IObjectContextAdapter)new ReviewRDbContext()).ObjectContext,
                new ContextConfiguration() { ScaffoldAllTables = true });
            DefaultModel.DynamicDataFolderVirtualPath = "~/DynamicData/DynamicData";

            // This route must come first to prevent some other route from the site to take over
            routes.Insert(0, new DynamicDataRoute("_dbadmin/{table}/{action}")
            {
                Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                Model = DefaultModel
            });

            routes.MapPageRoute(
                "dd_default",
                "_dbadmin",
                "~/DynamicData/Default.aspx");
        }
示例#53
0
        public static void Register(RouteCollection routes, IConfiguration configuration)
        {
            DefaultModel.RegisterContext(
                new EFCodeFirstDataModelProvider(
                    () => new EntitiesContext(configuration.SqlConnectionString, readOnly: false)), // DB Admins do not need to respect read-only mode.
                    configuration: new ContextConfiguration { ScaffoldAllTables = true });

            // This route must come first to prevent some other route from the site to take over
            routes.Insert(
                0,
                new DynamicDataRoute("dbadmin/{table}/{action}")
                    {
                        Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                        Model = DefaultModel
                    });

            routes.MapPageRoute(
                "dd_default",
                "dbadmin",
                "~/DynamicData/Default.aspx");
        }
示例#54
0
        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Add(new CustomViewEngine());

            var lstRoute = new List<Route>();

            lstRoute.Add(routes.MapRoute("Plugin.Misc.Branches.BranchGroup.Admin",
                "Admin/BranchGroup/{action}/{id}",
                new { controller = "BranchGroup", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Brances.Controllers" }
                ));
            lstRoute.Add(routes.MapRoute("Plugin.Misc.Branches.Branch.Admin",
                "Admin/Branch/{action}/{id}",
                new {controller = "Branch", action = "Index", id = UrlParameter.Optional},
                new[] {"Toi.Plugin.Misc.Brances.Controllers"}
                ));

            lstRoute.Add(routes.MapRoute("BranchGroup",
                "BranchGroup/{action}/{id}",
                new { controller = "BranchGroupRead", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Brances.Controllers" }
                ));

            //lstRoute.Add(routes.MapRoute("BranchGroupNavigation",
            //    "BranchGroupNavigation",
            //    new { controller = "BranchGroup", action = "BranchGroupNavigation", id = UrlParameter.Optional },
            //    new[] { "Toi.Plugin.Misc.Brances.Controllers" }
            //    ));
            foreach (var route in lstRoute)
            {
                routes.Remove(route);
                routes.Insert(0, route);
            }
            //routes.MapRoute("BranchAdmin",
            //      "Admin/Plugins/BranchManagement/BranchAdmin/{action}/{id}",
            //      new { controller = "BranchAdmin", action = "Index", id = UrlParameter.Optional },
            //      new[] { "Nop.Plugin.Other.BranchManagement.Controllers" }
            // ).DataTokens.Add("area", "admin"); ;
        }
示例#55
0
        public void ConfigureRoutes(RouteCollection routes)
        {
            var culture = StrixPlatform.DefaultCultureCode.ToLower();

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.LowercaseUrls = true;
            routes.RouteExistingFiles = true;

            var adminRoute = RouteTable.Routes.MapLocalizedRoute(
                 "Admin_default",
                 "{language}/Admin/{controller}/{action}/{id}",
                 new { language = culture, controller = WebConstants.ADMIN, action = MvcConstants.INDEX, id = UrlParameter.Optional },
                 new { controller = new AdminRouteConstraint() });

            routes.RemoveAt(routes.Count - 1);
            routes.Insert(0, adminRoute);

            routes.MapLocalizedRoute(
                "NotFound",
                "{language}/NotFound/{url}",
                new { language = culture, controller = "Home", action = "NotFound", url = UrlParameter.Optional });

            routes.MapLocalizedRoute(
                "Error",
                "{language}/Error",
                new { language = culture, controller = "Home", action = "Error" });

            routes.MapLocalizedRoute(
                name: "Search",
                url: "{language}/Search/{action}/{options}",
                defaults: new { language = culture, controller = "Search", action = "Index", options = UrlParameter.Optional });

            routes.MapLocalizedRoute(
                name: "Default",
                url: "{language}/{controller}/{action}/{id}",
                defaults: new { language = culture, controller = "Home", action = "Index", id = UrlParameter.Optional });
        }
示例#56
0
        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Add(new CustomViewEngine());

            var lstRoute = new List<Route>();

            lstRoute.Add(routes.MapRoute("Plugin.Misc.Services.Service.Admin",
                "Admin/Service/{action}/{id}",
                new {controller = "Service", action = "Index", id = UrlParameter.Optional},
                new[] {"Toi.Plugin.Misc.Services.Controllers"}
                ));

            lstRoute.Add(routes.MapRoute("Services",
                "Services",
                new { controller = "ServiceRead", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Services.Controllers" }
                ));

            foreach (var route in lstRoute)
            {
                routes.Remove(route);
                routes.Insert(0, route);
            }
        }
示例#57
0
        public void RegisterRoutes(RouteCollection routes)
        {
            //var route = routes.MapRoute("Plugin.Misc.VendorMembership.VendorMembershipController",
            //    "VendorMembership/{action}/{id}",
            //    new { controller = "VendorMembership", action = "Dashboard", id = UrlParameter.Optional },
            //    new[] { "Nop.Plugin.Misc.VendorMembership.Controllers" }
            //);
            //routes.Remove(route);
            //routes.Insert(0, route);

            var route = routes.MapRoute("Plugin.Misc.VendorMembership.Vendor.ProductsController",
                "Vendor/Products/{action}/{id}",
                new { area = "Vendor", controller = "Products", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Misc.VendorMembership.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Vendor.OrdersController",
                "Vendor/Orders/{action}/{id}",
                new { area = "Vendor", controller = "Orders", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Misc.VendorMembership.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Vendor.AccountController",
                "Vendor/Account/{action}",
                new { area = "Vendor", controller = "Account", action = "Index" },
                new[] { "Nop.Plugin.Misc.VendorMembership.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);
            
            route = routes.MapRoute("Plugin.Misc.VendorMembership.Vendor.Dashboard",
                "Vendor",
                new { area = "Vendor", controller = "Dashboard", action = "Index" },
                new[] { "Nop.Plugin.Misc.VendorMembership.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Vendor.SettingsController",
                "Vendor/Settings",
                new { area = "Vendor", controller = "Settings", action = "Index" },
                new[] { "Nop.Plugin.Misc.VendorMembership.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Vendor.InvoicesController",
                "Vendor/Invoices/{action}",
                new { area = "Vendor", controller = "Invoices", action = "Index" },
                new[] { "Nop.Plugin.Misc.VendorMembership.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Admin.MultitenancyController",
                "Admin/Multitenancy/{action}",
                new { area = "Admin", controller = "Multitenancy", action = "Settings" },
                new[] { "Nop.Plugin.Misc.VendorMembership.Areas.Admin.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Admin.VendorTypesController",
                "Admin/VendorTypes/{action}",
                new { area = "Admin", controller = "VendorTypes", action = "Index" },
                new[] { "Nop.Plugin.Misc.VendorMembership.Areas.Admin.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Theme.Controllers",
                "Theme/Home/{action}/{id}",
                new { area = "Theme", controller = "Home", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Misc.VendorMembership.Areas.Theme.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Theme.Controllers",
                "Theme",
                new { area = "Theme", controller = "Home", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Misc.VendorMembership.Areas.Theme.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Areas.Vendor.Controllers.ReturnRequestController",
                "Vendor/ReturnRequest/{action}",
                new { area = "Vendor", controller = "ReturnRequest", action = "Index" },
                new[] { "Nop.Plugin.Misc.VendorMembership.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Misc.VendorMembership.Areas.Vendor.Controllers.DashboardController",
                "Vendor/Dashboard/{action}",
                new { area = "Vendor", controller = "Dashboard", action = "Index" },
                new[] { "Nop.Plugin.Misc.VendorMembership.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
        private void InsertNewMapRoute(RouteCollection routes, string name, string url, string controllerName, string actionName, object routeParams = null, bool isAdmin = true, bool expectsId = false, bool insertAtZeroRoute = true)
        {
            object controllerParams = null;
            if (!expectsId)
                controllerParams = new { controller = controllerName, action = actionName };
            else
            {
                controllerParams = new { controller = controllerName, action = actionName, Id = UrlParameter.Optional };
                if (routeParams == null)
                    routeParams = new { id = @"\d+" };
            }

            var newMapRoute = routes.MapRoute(name, url, controllerParams, routeParams, new[] { "Qixol.Nop.Controllers" } );

            if(isAdmin)
                newMapRoute.DataTokens.Add("area", "admin");

            if (insertAtZeroRoute)
            {
                routes.Remove(newMapRoute);
                routes.Insert(0, newMapRoute);
            }
        }
        public void RegisterRoutes(RouteCollection routes)
        {
            #region Custom View Engine

            global::System.Web.Mvc.ViewEngines.Engines.Insert(0, new PromoViewEngine());

            #endregion

            #region admin routes

            var promosProductFeedRoute = routes.MapRoute("Qixol.Promos.GenerateFeed",
                    "Admin/PromosFeed/Admin/Feed/PromosFeed",
                    new { controller = "PromoAdmin", action = "GenerateFeed" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
            );
            promosProductFeedRoute.DataTokens.Add("area", "admin");

            var adminDiscountRoute = routes.MapRoute("QixolPromosAdminDiscount",
                    "Admin/Discount/{action}/{id}",
                    new { controller = "AdminDiscount", action = "Index", id = "", area = "PromoAdmin" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
            );
            adminDiscountRoute.DataTokens.Add("area", "admin");
            routes.Remove(adminDiscountRoute);
            routes.Insert(0, adminDiscountRoute);

            #endregion

            #region website routes

            routes.MapRoute("PromoContinueShopping",
                "checkout/continueshopping",
                new { controller = "Checkout", action = "ContinueShopping" },
                new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                );

            var promosShoppingCartRoute = routes.MapRoute("PromosShoppingCart",
                    "cart/",
                    new { controller = "ShoppingCart", action = "Cart" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            routes.Remove(promosShoppingCartRoute);
            routes.Insert(0, promosShoppingCartRoute);

            var promosCheckoutRoute = routes.MapRoute("PromoCheckout",
                    "checkout",
                    new { controller = "PromoCheckout", action = "PromoIndex" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            routes.Remove(promosCheckoutRoute);
            routes.Insert(0, promosCheckoutRoute);

            var promosCheckoutShippingMethodRoute = routes.MapRoute("PromoCheckoutShippingMethod",
                    "checkout/shippingmethod",
                    new { controller = "Checkout", action = "ShippingMethod" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            routes.Remove(promosCheckoutShippingMethodRoute);
            routes.Insert(0, promosCheckoutShippingMethodRoute);

            var promosCheckoutOpcSaveShippingRoute = routes.MapRoute("PromoCheckoutOpcSaveShipping",
                    "checkout/OpcSaveShipping",
                    new { controller = "Checkout", action = "OpcSaveShipping" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            routes.Remove(promosCheckoutOpcSaveShippingRoute);
            routes.Insert(0, promosCheckoutOpcSaveShippingRoute);

            var promosCheckoutOnePageRoute = routes.MapRoute("PromoCheckoutOnePage",
                    "onepagecheckout/",
                    new { controller = "Checkout", action = "PromoOnePageCheckout" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            //routes.Remove(promosCheckoutOnePageRoute);
            //routes.Insert(0, promosCheckoutOnePageRoute);

            var missedPromotionsRoute = routes.MapRoute("PromoCheckoutMissedPromotions",
                    "checkout/missedpromotions",
                    new { controller = "PromoCheckout", action = "MissedPromotions" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            // do NOT remove and reinsert - loses name

            #endregion
        }
        /// <summary>
        /// Looks for a GUID at the start of the route and resolves it to its correct Sitecore path.
        /// </summary>
        /// <param name="routes"></param>
        private static void ResolveSitecoreRoutePaths(RouteCollection routes)
        {
            var ignorePaths = new List<string>();

            foreach (Route route in routes)
            {
                if (!route.Url.StartsWith("{"))
                {
                    continue;
                }

                var elements = route.Url.Split('/');

                if(elements.Length == 0)
                {
                    continue;
                }

                Guid guid;

                if (!Guid.TryParse(elements[0], out guid)) continue;

                var pathItem = Sitecore.Context.Database.GetItem(guid.ToString());

                if (pathItem != null)
                {
                    var options = UrlOptions.DefaultOptions;
                    options.AddAspxExtension = false;
                    options.LanguageEmbedding = LanguageEmbedding.Never;
                    var path = LinkManager.GetItemUrl(pathItem, options).TrimStart('/');
                    route.Url = route.Url.Replace(elements[0], path);

                    path = path + "/";

                    if (!ignorePaths.Contains(path))
                    {
                        ignorePaths.Add(path);
                    }
                }
            }

            var addIgnore = Sitecore.Configuration.Settings.GetSetting("MvcRouting.AddBaseIgnoreForRoutes");

            if(!string.IsNullOrEmpty(addIgnore) && addIgnore == "true")
            {
                foreach (var ignorePath in ignorePaths)
                {
                    routes.Insert(0, new Route(ignorePath,new StopRoutingHandler()));
                }
            }
        }