Пример #1
0
        protected void Application_Start()
        {
            RoleRepository repo = new RoleRepository();
            repo.InitRole();

            ControllerActionRepository actionAuthorizationRepo = new ControllerActionRepository();
            actionAuthorizationRepo.UpdateActionList();

            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);
        }
        public List <string> GetRolesByActionDescriptor(ActionDescriptor actionDescriptor)
        {
            List <string> roles = new List <string>();

            if (actionDescriptor != null)
            {
                ControllerActionRepository controllerActionRepository = new ControllerActionRepository();

                ControllerAction controllerAction = controllerActionRepository.Get(actionDescriptor);

                roles = GetRolesByControllerAction(controllerAction);
            }

            return(roles);
        }
        public List<string> GetRolesByActionDescriptor(ActionDescriptor actionDescriptor)
        {
            List<string> roles = new List<string>();

            if (actionDescriptor != null)
            {
                ControllerActionRepository controllerActionRepository = new ControllerActionRepository();

                ControllerAction controllerAction = controllerActionRepository.Get(actionDescriptor);

                roles = GetRolesByControllerAction(controllerAction);
            }

            return roles;
        }
        protected void Application_Start()
        {
            ControllerActionRepository actionAuthorizationRepo = new ControllerActionRepository();
            actionAuthorizationRepo.UpdateActionList();

            AppSettingRepository appSettingRepository = new AppSettingRepository();
            appSettingRepository.Reload();

            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);

            var copy = ViewEngines.Engines.ToList();
            ViewEngines.Engines.Clear();
            foreach (var item in copy)
            {
                ViewEngines.Engines.Add(new ProfilingViewEngine(item));
            }

            GlobalFilters.Filters.Add(new ProfilingActionFilter());

            ModelBinders.Binders.Add(typeof(decimal?), new NullableDecimalModelBinder());
            ModelBinders.Binders.Add(typeof(decimal), new NullableDecimalModelBinder());
        }
Пример #5
0
        public ActionResult UpdateControllerAction()
        {
            RoleRepository repo = new RoleRepository();
            repo.InitRole();

            ControllerActionRepository actionAuthorizationRepo = new ControllerActionRepository();
            actionAuthorizationRepo.UpdateActionList();

            return RedirectToAction("Index", "Home");
        }