Exemple #1
0
        public RoleAccessDTOs GetRoleAccessUserAccesData(int moduleId, int roleId)
        {
            RolesAccess roleAccessUserData = _unitOfWork.RolesAccessRepository.Get(x => x.AssignModuleId == moduleId && x.AssignRoleId == roleId).SingleOrDefault();

            if (roleAccessUserData != null)
            {
                return(RoleAccessResponseFormatter.RoleAccessModuleData(roleAccessUserData));
            }
            return(null);
        }
Exemple #2
0
        public List <RoleAccessDTOs> GetRoleAccessData(int roleID)
        {
            List <RolesAccess> roleAccessData = _unitOfWork.RolesAccessRepository.Get(x => x.AssignRoleId == roleID).ToList();

            if (roleAccessData != null)
            {
                return(RoleAccessResponseFormatter.GetAllRolesAndAccess(roleAccessData));
            }
            //throw new UnauthorizedAccessException("User Not Found");
            return(null);
        }
Exemple #3
0
        //public dynamic GetNotInModules(int roleId)
        //{
        //    var ModulesList = _unitOfWork.ModuleRepository.All();
        //   var parentModulesList = _unitOfWork.ParentModuleRepository.All();
        //    List<Module> data = new List<Module>();
        //    var parentModuleId = (from ml in parentModulesList select ml.ParentModulesId);
        //    var query = (from ml in ModulesList where parentModuleId.Contains(ml.ModuleParentId) select ml);
        //    return query;
        //}

        //public dynamic GetParentModules(int parentModuleId, int roleId)
        //{
        //    var ModulesList = _unitOfWork.ModuleRepository.All();
        //    var parentModulesList = _unitOfWork.ParentModuleRepository.All();
        //    List<Module> data = new List<Module>();
        //    var roleAccessData = _unitOfWork.RolesAccessRepository.Get(x => x.AssignRoleId == roleId);
        //    var roleDataAssignModel = (from ml in roleAccessData select ml.AssignModuleId);
        //    var query = (from ml in ModulesList where (ml.ModuleParentId == parentModuleId) && !roleDataAssignModel.Contains(ml.ModuleId) select ml);
        //    return query;
        //}

        //public dynamic GetParentModulesList()
        //{
        //    var parentModulesList = _unitOfWork.ParentModuleRepository.All();
        //    List<ParentModule> data = new List<ParentModule>();
        //    foreach (var item in parentModulesList)
        //    {
        //        data.Add(item);
        //    }
        //    return data;
        //}
        public IEnumerable <RolesAccessDTO> GetRoleByRoleID(int roleId)
        {
            IEnumerable <RolesAccess> roleAccessData = _unitOfWork.RolesAccessRepository.All().Where(x => x.AssignRoleId == roleId).ToList();

            return(RoleAccessResponseFormatter.ModelData(roleAccessData));
        }
Exemple #4
0
        public IEnumerable <RolesAccessDTO> GetAllRolesAccess()
        {
            IEnumerable <RolesAccess> modelDatas = _unitOfWork.RolesAccessRepository.All().ToList();

            return(RoleAccessResponseFormatter.ModelData(modelDatas));
        }