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()); }
public async Task <ActionResult <ResultOutDto <IEnumerable <Application> > > > GetApplications( [FromQuery] ApplicationFilterInDto filterOptions) { return(Ok(ResultOutDtoBuilder .Success(await _applicationService.Filter(filterOptions)))); }