private IQueryable <SpeciesInfo> GetFilteredQuery(GetSpeciesInfoInput input) { var query = QueryableExtensions.WhereIf(_speciesInfoRepository.GetAll(), !input.Filter.IsNullOrWhiteSpace(), u => u.Name.Contains(input.Filter) || u.Code.Contains(input.Filter)); return(query); }
public async Task <PagedResultDto <SpeciesInfoListDto> > GetSpeciesInfo(GetSpeciesInfoInput input) { var query = GetFilteredQuery(input); var userCount = await query.CountAsync(); var speciesInfos = await query .OrderBy(input.Sorting) .PageBy(input) .ToListAsync(); var speciesInfosListDto = ObjectMapper.Map <List <SpeciesInfoListDto> >(speciesInfos); return(new PagedResultDto <SpeciesInfoListDto>( userCount, speciesInfosListDto )); }