public async Task <IActionResult> Details(int id, int quantity, string userName) { BasketItem item = new BasketItem(); item.ProductID = id; item.UserBasketID = _context.UserBasket.Where(user => user.UserID == userName).FirstOrDefault().ID; item.Quantity = quantity; item.CheckedOut = false; await _cart.AddBasketItem(item); var product = await _product.GetProductById(id); return(RedirectToAction("Index")); }