示例#1
0
 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)));
 }
示例#3
0
        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());
            }));
        }