public IQueryable <AppUser> FilterAppUsers(IQueryable <AppUser> query, AppUserFilterRequest appUserFilterRequest) { if (!string.IsNullOrWhiteSpace(appUserFilterRequest.Search)) { query = query.Where(x => x.Username.ToLower().Contains(appUserFilterRequest.Search.ToLower())); } return(query); }
public async Task <ServerResponse <List <AppUserViewModel> > > GetAppUsersAsync(AppUserFilterRequest appUserFilterRequest) { return(AOResultToServerResponse(await _appUserService.GetAppUsersAsync(AccountId, appUserFilterRequest))); }
public async Task <AOResult <List <AppUserViewModel> > > GetAppUsersAsync(int accountId, AppUserFilterRequest appUserFilterRequest) { return(await BaseInvokeAsync(async() => { var query = _myHelperDbContext.AppUsers .Where(x => x.Id != accountId); query = FilterAppUsers(query, appUserFilterRequest); query = FetchItems(query, appUserFilterRequest); return AOBuilder.SetSuccess(await query.ToAsyncEnumerable().Select(x => _mapper.Map <AppUser, AppUserViewModel>(x)).ToList()); })); }