コード例 #1
0
ファイル: ApplicationService.cs プロジェクト: Sanyam07/impls
        public async Task <List <Application> > Filter(ApplicationFilterInDto filterOptions)
        {
            var filtered = _context.Applications
                           .TimeRangeFilter(filterOptions)
                           .Where(app =>
                                  (string.IsNullOrWhiteSpace(filterOptions.NameMatch) || app.Name.Contains(filterOptions.NameMatch)));
            var ordered = filterOptions.CreateTimeDesc
                ? filtered.OrderByDescending(a => a.CreateTime)
                : filtered.OrderBy(a => a.CreateTime);

            return(await ordered.SkipTakePaging(filterOptions).ToListAsync());
        }
コード例 #2
0
 public async Task <ActionResult <ResultOutDto <IEnumerable <Application> > > > GetApplications(
     [FromQuery] ApplicationFilterInDto filterOptions)
 {
     return(Ok(ResultOutDtoBuilder
               .Success(await _applicationService.Filter(filterOptions))));
 }