public ActionResult UpdateBasketItemQuantity(int basketId, int basketitemid, int supplierId, int quantity) { if (quantity != 0) { var price = _orderApi.AllItemsForOrderBasket(basketId, 1) .FirstOrDefault(x => x.RetailerOrderBasketItemId == basketitemid) .PricePerUnit; _orderApi.UpdateOrderBasketItem(new OrderBasketItemPost() { RetailerId = 1, OrderBasketItem = new OrderBasketItem() { RetailerOrderBasketItemId = basketitemid, OrderBasketId = basketId, NumberOfUnits = quantity, TotalPrice = quantity * price } }); } // If quantity = 0, item should be deleted from basket else { _orderApi.DeleteOrderBasketItem(new OrderBasketItemPost() { RetailerId = 1, OrderBasketItem = new OrderBasketItem() { RetailerOrderBasketItemId = basketitemid, OrderBasketId = basketId } }); } return(OrderBasket(basketId)); }