예제 #1
0
        public async Task <PagedResponse <AppSettingViewModel> > QueryPageList(AppSettingPageRequest request)
        {
            PagedResponse <AppSettingViewModel> result = new PagedResponse <AppSettingViewModel>();

            try
            {
                Expression <Func <AppSettingViewModel, bool> > wherepre = a => !a.IsDeleted;// a.Key.Contains(request.Key);
                if (!string.IsNullOrWhiteSpace(request.Key))
                {
                    Expression <Func <AppSettingViewModel, bool> > wherenext = w => w.Key.Contains(request.Key.Trim());
                    wherepre = wherepre.AndAlso(wherenext);
                }
                result.IsSuccess = true;
                result.Total     = await _dbContext.AppSettingByCafs.AsNoTracking().CountAsync(wherepre);

                result.Datas = await _dbContext.AppSettingByCafs.AsNoTracking().Where(wherepre).Skip(request.PageSize * (request.PageIndex - 1)).Take(request.PageSize).ToListAsync();
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }
            return(result);
        }
예제 #2
0
 public async Task <PagedResponse <AppSettingViewModel> > QueryPageList([FromBody] AppSettingPageRequest request)
 {
     return(await _appSettingsService.QueryPageList(request));
 }