Пример #1
0
        public async Task <PagingResult <TItem> > Get <TItem>(int pageNumber, int pageSize)
        {
            Logger.LogDebug($"{nameof(DinosaursService)}.{nameof(Get)}({pageNumber}, {pageSize})");
            int offset = (pageNumber - 1) * pageSize;
            int count  = await _dinosaursRepository.DinosaursCount();

            var items = await _dinosaursRepository.GetAll(pageSize, offset);

            var mappedItems = Mapper.Map <IEnumerable <TItem> >(items);

            return(new PagingResult <TItem>(mappedItems, pageNumber, pageSize, count));
        }
Пример #2
0
        public async Task <TItem> GetParkInfo <TItem>()
        {
            Logger.LogDebug($"{nameof(InformationService)}.{nameof(GetParkInfo)}()");
            var items = await _informationRepository.GetParkInfo();

            int dinosaursCount = await _dinosaursRepository.DinosaursCount();

            int speciesCount = await _dinosaursRepository.SpeciesCount();

            var countInformation = new CountInformation(speciesCount, dinosaursCount);

            return(Mapper.Map <TItem>((items, countInformation)));
        }