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