public Task <BaseFindResponse <User> > FindAsync(UserFindRequest request) { return(Task.Run(() => { var query = context.UsersAsQueryable.Where(a => !a.IsAdmin); if (request.RoleId.HasValue()) { query = query.Where(a => a.RoleId == request.RoleId); } if (!string.IsNullOrEmpty(request.Email)) { query = query.Where(a => a.Email.ToLowerInvariant().Contains(request.Email.ToLowerInvariant())); } var response = query.OrderByDescending(a => a.CreatedDate) .Skip(request.Skip) .Take(request.PageSize) .ToList(); return new BaseFindResponse <User> { Results = response.ToList(), TotalRecords = query.Count() }; })); }
/// <summary> /// 修改密码 /// </summary> /// <param name="request"></param> /// <returns></returns> public UserFindResponse FindPwd(UserFindRequest request) { UserFindResponse userFindResponse = new UserFindResponse(); if (string.IsNullOrEmpty(request.Pwd)) { userFindResponse.Status = false; userFindResponse.Message = "密码不能为空"; return(userFindResponse); } var password = MD5Encrypt.MD5Encrypt32(request.Pwd); var res = dal.FindPwd(request.UserName, password); if (res > 0) { userFindResponse.FindSuccess = true; userFindResponse.Message = "密码修改成功"; } else { userFindResponse.FindSuccess = false; userFindResponse.Message = "密码修改失败"; } return(userFindResponse); }
public User ReadById(UserFindRequest request) { using (var _context = new ShoppingListContext()) { return(_context.User .Where(u => u.Id == request.Id) .Include(au => au.Addresses.Select(u => u.User_Id == request.Id)) .FirstOrDefault()); } }
/// <summary> /// 修改密码 /// </summary> /// <param name="userFindRequest"></param> /// <returns></returns> public UserFindResponse UserFind(UserFindRequest userFindRequest) { return(ApiRequestHelper.Post <UserFindRequest, UserFindResponse>(userFindRequest)); }
public UserFindResponse FindPwd(UserFindRequest request) { return(UserBll.Instance.FindPwd(request)); }
/// <summary> /// 修改密码 /// </summary> /// <param name="userFindRequest"></param> /// <returns></returns> public JsonResult UserFind(UserFindRequest userFindRequest) { var res = bll.UserFind(userFindRequest); return(Json(res)); }
public Task <BaseFindResponse <User> > FindAsync(UserFindRequest request) { return(_userRepository.FindAsync(request)); }