Beispiel #1
0
        public async Task <IActionResult> AboutToProduct(int?id,
                                                         int?currentPosition)
        {
            if (id != null)
            {
                BigProductCardAndBasket result = await _dataProcessingConveyor.GetBigProductCardAndBasketAsync((int)id);

                if (result != null)
                {
                    _session.SetString("CurrentPositionProduct", currentPosition.ToString());
                    return(View(result));
                }
            }
            return(NotFound());
        }
Beispiel #2
0
        public async Task <BigProductCardAndBasket> GetBigProductCardAndBasketAsync(int id)
        {
            BigProductCardAndBasket result = new BigProductCardAndBasket();
            string         keyName         = $"BigProductCards:{id}";
            BigProductCard bigProductCard  = _cacheService.Get <BigProductCard>(keyName);

            if (bigProductCard == null)
            {
                bigProductCard = await _fcdStoreContext.GetBigProductCard(id);

                _cacheService.Set <BigProductCard>(keyName, bigProductCard);
            }
            result.BigProductCard   = bigProductCard;
            result.ProductsInBasket = await GetProductsInBasketAsync();

            result.SetBasketsCost();
            return(result);
        }