Rebel.Cms.Web.Mvc.Areas.RebelAreaRegistration.MapRouteSurfaceControllers C# (CSharp) Method

MapRouteSurfaceControllers() private method

This maps locally declared (non-package) surface controllers so that they are routing through the Rebel back office path /Rebel (or what is defined in config)
private MapRouteSurfaceControllers ( RouteCollection routes, IEnumerable surfaceControllers ) : void
routes RouteCollection
surfaceControllers IEnumerable
return void
        private void MapRouteSurfaceControllers(RouteCollection routes, IEnumerable<SurfaceMetadata> surfaceControllers)
        {
            foreach (var s in surfaceControllers.Where(x => x.PluginDefinition == null))
            {
                var route = routes.MapRoute(
                    string.Format("rebel-{0}-{1}", "surface", s.ControllerName),
                    AreaName + "/Surface/" + s.ControllerName + "/{action}/{id}",//url to match
                    new { controller = s.ControllerName, action = "Index", id = UrlParameter.Optional },
                    new[] { s.ComponentType.Namespace }); //only match this namespace
                    route.DataTokens.Add("area", AreaName); //only match this area
                    route.DataTokens.Add("rebel", "surface"); //ensure the rebel token is set
            }
        }