public IEnumerable <Role> Get() { try { return(dal.Get()); } catch (Exception) { throw new Exception("出现程序错误,请联系管理员!"); } }
/// <summary> /// 保存角色信息和权限 /// </summary> /// <param name="sessionModel"></param> /// <param name="employee"></param> /// <returns></returns> private IEnumerable <string> GetRoleSession(ref LoginSessionModel sessionModel, Employee employee) { List <string> list = new List <string>(); //部门或角色为空, if (employee.RoleId.IsNullOrEmpty() || employee.DepartmentId.IsNullOrEmpty()) { return(list); } else { var RoleDept = DepartmentRoleDAL.Get(u => u.Enable && u.DepartmentId == employee.DepartmentId && u.RoleId == employee.RoleId); if (RoleDept == null) { return(list); } var Role = RoleDAL.Get(u => u.Enable && u.RoleId == RoleDept.RoleId); if (Role == null) { return(list); } sessionModel.Role = Role; var appList = DepartmentRoleApplicationDAL.GetModels(u => u.Enable && u.DepartmentId == employee.DepartmentId && u.RoleId == employee.RoleId).Select(u => u.ApplicationId); if (appList.IsNullOrEmpty()) { return(list); } else { return(list = appList.ToList()); } } }
public async Task <UsersDTO> Put(UserDTO userDTO) { User user = _mapper.Map <User>(userDTO); user.Role = await _role.Get(m => m.RoleId == userDTO.RoleId); int updatedUserId = await _user.Put(user); return(_mapper.Map <UsersDTO>(await _user.AddedOrUpdatedUser(updatedUserId))); }
public RoleDTO Get(int id) { try { return dal.Get(id); } catch (Exception e) { Logger.Logger.WriteLog(e); throw e; } }
/// <summary> /// 获取所有岗位 /// </summary> /// <param name="roleName">岗位名称 模糊查询</param> /// <param name="sort"></param> /// <param name="ordering"></param> /// <param name="num"></param> /// <param name="page"></param> /// <returns></returns> public MessageEntity Get(string roleName = "", string sort = "cRoleName", string ordering = "desc", int num = 20, int page = 1) { var result = _roleDAL.Get(roleName, sort, ordering, num, page); return(result); }
public bool Delete(int entityID) { Role role = _roleDAL.Get(a => a.RoleID == entityID); return(_roleDAL.Delete(role) > 0); }