Exemple #1
0
        private IQueryable <EpidemiologicInfo> GetFilteredQuery(GetEpidemiologicInfoInput input)
        {
            var query = QueryableExtensions.WhereIf(_epidemiologicInfoRepository.GetAll(),
                                                    !input.Filter.IsNullOrWhiteSpace(), u =>
                                                    u.Family.Contains(input.Filter) ||
                                                    u.Name.Contains(input.Filter) ||
                                                    u.Code.Contains(input.Filter));

            return(query);
        }
Exemple #2
0
        public async Task <PagedResultDto <EpidemiologicInfoListDto> > GetEpidemiologicInfo(GetEpidemiologicInfoInput input)
        {
            var query     = GetFilteredQuery(input);
            var userCount = await query.CountAsync();

            var epidemiologicInfos = await query
                                     .OrderBy(input.Sorting)
                                     .PageBy(input)
                                     .ToListAsync();

            var epidemiologicInfosListDto = ObjectMapper.Map <List <EpidemiologicInfoListDto> >(epidemiologicInfos);

            return(new PagedResultDto <EpidemiologicInfoListDto>(
                       userCount,
                       epidemiologicInfosListDto
                       ));
        }