Exemplo n.º 1
0
        public List <RoleAccessViewModel> GetRoleAccessByRoleId(int roleId)
        {
            List <RoleAccess>          result       = _roleAccessRepository.GetMany(ra => ra.RoleId == roleId).ToList();
            List <RoleAccessViewModel> mappedResult = new List <RoleAccessViewModel>();

            return(Map(result, mappedResult));
        }
Exemplo n.º 2
0
        public List <RoleAccessViewModel> RetrieveAllRoleAccess()
        {
            Role                       superAdminRole     = _roleRepository.GetMany(r => string.Compare(r.Name, DbConstant.ROLE_SUPERADMIN, true) == 0).FirstOrDefault();
            ApplicationModul           accessibilityModul = _applicationModulRepository.GetMany(a => string.Compare(a.ModulName, DbConstant.MODUL_ACCESSIBILITY, true) == 0).FirstOrDefault();
            List <RoleAccess>          result             = _roleAccessRepository.GetMany(ra => ra.RoleId != superAdminRole.Id && ra.ApplicationModulId != accessibilityModul.Id).ToList();
            List <RoleAccessViewModel> mappedResult       = new List <RoleAccessViewModel>();

            return(Map(result, mappedResult));
        }
 public override bool Validate(params object[] parameters)
 {
     if (parameters.Length > 2)
     {
         int roleId = parameters[0].AsInteger();
         int appId  = parameters[1].AsInteger();
         int id     = parameters[2].AsInteger();
         return(_roleAccessRepository.GetMany(ra => ra.RoleId == roleId &&
                                              ra.ApplicationModulId == appId &&
                                              ra.Id != id).FirstOrDefault() == null);
     }
     else
     {
         int roleId = parameters[0].AsInteger();
         int appId  = parameters[1].AsInteger();
         return(_roleAccessRepository.GetMany(ra => ra.RoleId == roleId &&
                                              ra.ApplicationModulId == appId).FirstOrDefault() == null);
     }
 }