public async Task <Pagination <UserInfo> > SearchUsersAsync(UserFilterInput filter) { using (_dbContextScopeFactory.CreateReadOnly()) { var users = await GetAllUserInfoAsync(); int count = users.Count; if (!string.IsNullOrEmpty(filter.Key)) { count = _userInfos.Count(user => user.SearchText.Contains(filter.Key)); } if (count == 0) { return(new Pagination <UserInfo>(0, new List <UserInfo>())); } int skip = (filter.Page - 1) * filter.PageSize; int take = filter.PageSize; var searchUsers = _userInfos .Where(user => user.SearchText.Contains(filter.Key)) .Skip(skip) .Take(take) .ToList(); return(new Pagination <UserInfo>(count, searchUsers, skip, take)); } }
public IActionResult MainListPartial() { UserFilterInput filterInput = GetFilterInSession <UserFilterInput>(ConstantConfig.SessionName.UserSession); PagingResultDto <UserDto> pagingResult = userService.GetAllByPaging(filterInput); return(PartialView(pagingResult)); }
public async Task <PageResult <UserVm> > GetUsers(UserFilterInput filter) { var result = await _client.GetUsers.ExecuteAsync(filter); if (result.IsErrorResult()) { _snackbar.Add(string.Join('\n', result.Errors.Select(x => x.Message)), Severity.Error); } return(new PageResult <UserVm>(result.Data.Users)); }
public IActionResult GetAll(UserFilterInput filterInput = null) { if (filterInput == null) { filterInput = new UserFilterInput(); } var result = userService.GetAllByPaging(filterInput); return(Ok(result)); }
public IActionResult Index(int pageIndex = 1) { UserFilterInput filterInput = GetFilterInSession <UserFilterInput>(ConstantConfig.SessionName.UserSession); filterInput.PageNumber = pageIndex; UserViewModel userViewModel = new UserViewModel { FilterInput = filterInput, PagingResult = userService.GetAllByPaging(filterInput) }; InitAdminBaseViewModel(userViewModel); return(View(userViewModel)); }
public PagingResultDto <UserDto> GetAllByPaging(UserFilterInput filterInput) { SetDefaultPageSize(filterInput); IQueryable <WebCoreUser> userQuery = userRepository.GetAll(); userQuery = userQuery.Filter(filterInput); PagingResultDto <UserDto> userResult = userQuery .ProjectTo <UserDto>(mapper.ConfigurationProvider) .PagedQuery(filterInput); return(userResult); }
public async Task <UserPoco[]> GetFilteredUsers(UserFilterInput input) { try { var result = new List <UserPoco>(); var beginningOfTime = new DateTime(); switch (input.Filter) { case UserFilter.LockedOut: result = await _context.Users.Where(x => x.LockoutEnd > DateTimeOffset.UtcNow).ToListAsync(); break; case UserFilter.NeverLoggedIn: result = await _context.Users.Where(x => x.LastLoggedIn == beginningOfTime).ToListAsync(); break; case UserFilter.LoggedInLastMonth: result = await _context.Users.Where(x => x.LastLoggedIn == beginningOfTime).ToListAsync(); break; case UserFilter.LoggedIn: result = await _context.Users.Where(x => x.LastLoggedIn < (DateTime.Today.AddMonths(-1))).ToListAsync(); break; default: result = null; break; } return(result.ToArray()); } catch { return(null); } }
public IActionResult FilterPartial(UserFilterInput filterInput) { SetFilterToSession(ConstantConfig.SessionName.UserSession, filterInput); return(RedirectToAction("Index", new { page = 1 })); }
public async Task <JsonResult> GetFilteredUserList([FromBody] UserFilterInput input) { var result = await _user.GetFilteredUsers(input); return(await GenerateResult(result, _userSettings)); }