예제 #1
0
        public void Add(int functionalityId, int roleId)
        {
            AppRole role = AppRoleRepository.GetSingle(x => x.Id == roleId);

            if (role.AppRoleType == AppRoleType.Administrator)
            {
                throw new BussinesException(3, ErrorResource.CanNotAddFunctionalityToAdminRole);
            }
            if (IsFunctionalityRoleAdded(functionalityId, roleId))
            {
                return;
            }
            var entity = new FunctionalityAppRole()
            {
                FunctionalityId = functionalityId,
                AppRoleId       = roleId
            };

            FunctionalityAppRoleRepository.Add(entity);
        }
예제 #2
0
 public object GetFunctionalitiesToAdd(DataSourceLoadOptionsBase loadOptions, int roleId)
 {
     return(FunctionalityAppRoleRepository.GetFunctionalitiesToAdd(loadOptions, roleId));
 }
예제 #3
0
 public bool IsFunctionalityRoleAdded(int functionalityId, int roleId)
 {
     return(FunctionalityAppRoleRepository.Any(x => x.AppRoleId == roleId && x.FunctionalityId == functionalityId));
 }
예제 #4
0
 public void Delete(int functionalityRoleId)
 {
     FunctionalityAppRoleRepository.DeleteWhere(x => x.Id == functionalityRoleId);
 }