public override IController CreateController(RequestContext requestContext, string controllerName) { if (controllers != null && controllers.ContainsKey(controllerName)) { return controllers[controllerName](requestContext); } else { IController ctrl = base.CreateController(requestContext, controllerName); if (ctrl is IAdminModule || ctrl is IAdminModuleLoad) { if (ctrl is IAdminModule) { IAdminModule m = ((IAdminModule)ctrl); m.SiteID = new Guid(this.TestSiteID); m.ModuleID = Guid.Empty; } if (ctrl is IAdminModuleLoad) { IAdminModule data = new AdminModuleData(); data.SiteID = new Guid(this.TestSiteID); data.ModuleID = Guid.Empty; ((IAdminModuleLoad)ctrl).LoadData(data); } } if (ctrl is IWidget) { IWidget w = (IWidget)ctrl; w.SiteID = new Guid(this.TestSiteID); } return ctrl; } }
public override IController CreateController(RequestContext requestContext, string controllerName) { if (controllers != null && controllers.ContainsKey(controllerName)) { return controllers[controllerName](requestContext); } else { IController ctrl = base.CreateController(requestContext, controllerName); if (ctrl is IAdminModule || ctrl is IAdminModuleLoad) { var principal = requestContext.HttpContext.User; if (principal.Identity.IsAuthenticated) { if (ctrl is IAdminModule) { IAdminModule m = ((IAdminModule)ctrl); m.SiteID = SiteData.CurrentSiteID; m.ModuleID = Guid.Empty; } if (ctrl is IAdminModuleLoad) { IAdminModule data = new AdminModuleData(); data.SiteID = SiteData.CurrentSiteID; data.ModuleID = Guid.Empty; ((IAdminModuleLoad)ctrl).LoadData(data); } } else { ctrl = new CmsAdminController(); } } if (ctrl is IWidget) { IWidget w = (IWidget)ctrl; w.SiteID = SiteData.CurrentSiteID; } return ctrl; } }