Ejemplo n.º 1
0
        public async Task <Result <List <GetAllLineItemsResponse> > > Handle(GetAllLineItemsQuery request, CancellationToken cancellationToken)
        {
            var lineItemList = await _lineItem.GetListAsync();

            var mappedLineItems = _mapper.Map <List <GetAllLineItemsResponse> >(lineItemList);

            return(Result <List <GetAllLineItemsResponse> > .Success(mappedLineItems));
        }
Ejemplo n.º 2
0
 public async Task<List<LineItem>> GetCachedListAsync()
 {
     string cacheKey = LineItemCacheKeys.ListKey;
     var lineItemList = await _distributedCache.GetAsync<List<LineItem>>(cacheKey);
     if (lineItemList == null)
     {
         lineItemList = await _lineItemRepository.GetListAsync();
         await _distributedCache.SetAsync(cacheKey, lineItemList);
     }
     return lineItemList;
 }