コード例 #1
0
        public async Task <IActionResult> AddToBasket(ProductItemViewModel productDetails)
        {
            if (productDetails?.Id == null)
            {
                return(RedirectToAction("Index", "Products"));
            }

            BasketIndexViewModel basketViewModel = await GetCurrentUserBasket();

            BasketAddItemResponse response = await _basketService.AddItemToBasket(basketViewModel.Id, productDetails.Id, productDetails.Price, 1);

            return(RedirectToAction("Index"));
        }