예제 #1
0
        public int EditRole(RoleViewModel roleToEdit, ref ValidationStateDictionary states)
        {
            var v = new RoleValidator().Validate(roleToEdit, validationRepositoryInstance);

            if (v.Errors.Count > 0)
            {
                states.Add(typeof(RoleViewModel), v);
                return(0);
            }
            var rowAffected = repositoryInstance.EditRole(roleToEdit);

            cacheService.Remove(Constants.General.RoleModuleAccessList);
            //cacheService.Remove(Constants.General.RoleProfileList);
            cacheService.Remove(Constants.General.RoleList);
            cacheService.RemoveEndWith(Constants.General.RoleNames);

            return(rowAffected);
        }
예제 #2
0
        public void AddRole(RoleViewModel roleToAdd, ref ValidationStateDictionary states)
        {
            var v = new RoleValidator().Validate(roleToAdd, validationRepositoryInstance);

            if (v.Errors.Count > 0)
            {
                states.Add(typeof(RoleViewModel), v);
                return;
            }

            roleToAdd.CurrentRole.RoleId = Helper.GetNextGuid();
            repositoryInstance.AddRole(roleToAdd);

            cacheService.Remove(Constants.General.RoleModuleAccessList);
            //cacheService.Remove(Constants.General.RoleProfileList);
            cacheService.Remove(Constants.General.RoleList);
            cacheService.RemoveEndWith(Constants.General.RoleNames);
        }