Пример #1
0
        public async Task <IEnumerable <DepoDto> > GetByOrganizationAsync(int?organId)
        {
            var organs = organId is null
                ? await _unitOfWork.Depos.GetAsync()
                : await _unitOfWork.Depos.GetAsync(d => d.OrganizationId == organId);

            return(organs.Select(d => DepoDto.FromDomain(d)).ToList());
        }
Пример #2
0
        public async Task <PageDto <DepoDto> > GetPageAsync(int pageSize, int pageNumber)
        {
            var page  = new PageDto <DepoDto>(pageSize, pageNumber);
            var items = await _unitOfWork.Depos.GetPageAsync(pageSize, pageNumber);

            page.SetData(items.Item2, items.Item1.Select(i => DepoDto.FromDomain(i)).ToList());
            return(page);
        }
Пример #3
0
        public async Task <DepoDto> GetAsync(int id)
        {
            var depoDto = await _cacheStore.StoreAndGetAsync(GetCacheKey(id), async() =>
            {
                var depo = await Get(id);
                return(DepoDto.FromDomain(depo));
            });

            return(depoDto);
        }