public async Task <IActionResult> DeleteBasketItem(int ProductID) { var user = await _userManager.GetUserAsync(HttpContext.User); var ID = user.Id; await _basketItem.DeleteBasketItem(ProductID, ID); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Delete([FromRoute] int id) { var user = await _userManager.GetUserAsync(User); var basket = await _basket.GetBasketById(user); var basketItem = await _context.GetBasketItemById(id); if (basket.ID != basketItem.BasketID) { return(RedirectToAction("Index", "Home")); } string result = await _context.DeleteBasketItem(id); if (result == "Product Not Found") { return(NotFound()); } return(RedirectToAction("Details", "Basket")); }