public async Task <IActionResult> AddToCart(int id) { AppUser user = await _userManager.GetUserAsync(User); Cart cart = _sqlCart.GetCart(user); Product product = _sqlProduct.GetProduct(id); _sqlCart.AddProductToCart(product, cart); return(RedirectToAction(nameof(GetAllProducts))); }
public async Task <IActionResult> DeleteItem(int id) { AppUser user = await _userManager.GetUserAsync(User); Cart cart = _sqlCart.GetCart(user); var product = _sqlProduct.GetProduct(id); _sqlCart.DeleteProductFromCart(product, cart); return(RedirectToAction(nameof(cart))); }
public Product GetProduct(int productID) { return(sqlProd.GetProduct(productID)); }