/// <summary> /// 通过用户名查找用户 /// </summary> /// <param name="request"></param> /// <param name="context"></param> /// <returns></returns> public override async Task <UserReply> FindByUserName(UserNameReq request, ServerCallContext context) { ApplicationUser user = await userManager.FindByNameAsync(request.UserName).ConfigureAwait(false); var userReply = mapper.Map <UserReply>(user); return(userReply); }
/// <summary> /// 根据班级id获取用户列表 /// </summary> /// <param name="request"></param> /// <param name="context"></param> /// <returns></returns> public override async Task <UserList> GetUsersByClassId(UserNameReq request, ServerCallContext context) { var users = await userManager.Users.Where(e => e.ClassId == request.UserName).ToListAsync().ConfigureAwait(false); UserList userList = new UserList(); userList.Users.AddRange(users.Select(e => mapper.Map <UserReply>(e))); return(userList); }
public async Task <Employee> GetByUserName(UserNameReq req) { var obj = await GetAsync(c => c.UserName == req.UserName); if (obj != null && obj.Any()) { return(obj.FirstOrDefault()); } return(null); }
public async Task <HttpResponseMessage> GetUserGroupByUserName([FromUri] UserNameReq req) { try { var obj = await _loginBE.GetUserGroupByUserName(req); if (obj == null || !obj.Any()) { return(this.ErrorResult(new Error(EnumError.UserNotGrandPermission))); } return(this.OkResult(obj)); } catch (Exception ex) { return(this.ErrorResult(new Error("", ex.Message))); } }
public async Task <List <UserGroup> > GetUserGroupByUserName(UserNameReq req) { var employee = (await GetAsync(p => p.UserName == req.UserName))?.FirstOrDefault(); if (employee == null) { return(null); } var obj = await UserGroupEmployeeBE.GetAsync(p => p.EmployeeId == employee.EmployeeId); if (obj != null && obj.Any()) { var lstUserGroupCode = obj.Select(q => q.UserGroupCode).ToList(); var usergroups = await UserGroupBE.GetAsync(p => lstUserGroupCode.Contains(p.UserGroupCode)); return(usergroups.ToList()); } return(null); }