public async Task <IActionResult> Buy(int id) { string stringEmail = User.Identity.Name; Cart cart = await _context.GetCart(stringEmail); CartItems product = new CartItems(); product.InventoryID = id; product.Quantity = 1; product.CartID = cart.ID; await _context.AddCartItem(product); return(RedirectToAction("Index", "Cart", product)); }