public async Task <IActionResult> AddToCart([FromForm] BuyProductModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var shoppingItem = new ShoppingItem {
                Quantity = model.Quantity, ProductId = model.Id, ShoppingBagId = 1
            };

            await _shoppingItemRepository.Create(shoppingItem);

            return(RedirectToAction("Index", "Products"));
        }
        public async Task <IActionResult> AddToCart(int id)
        {
            var product = await _productRepository.Single(_ => _.Id == id);

            if (product == null)
            {
                return(RedirectToAction("Index", "Products"));
            }
            var model = new BuyProductModel
            {
                Id       = product.Id,
                Name     = product.Name,
                Price    = product.Price,
                Quantity = 0
            };

            return(View(model));
        }