public async Task <IActionResult> RemoveCart(int bookID) { //Gets Current User. var user = await _userManager.GetUserAsync(User); var userID = user.Id; //Removes cart item. _cartService.RemoveItem(userID, bookID); //Sees if User has an Order. bool userHasCurrentOrder = _orderService.UserHasCurrentOrder(userID); //If user has an order, we must delete the books from there as well. if (userHasCurrentOrder) { //Removes all Order Book Connections in the current order(which is a copy of cart.) var orderID = _orderService.GetCurrentOrderID(userID); _obcService.RemoveItem((int)orderID, bookID); } //Redirects user back to the cart. return(RedirectToAction("Cart", "Account")); }