public void FinalizeOrder(Customer customer) { VerifyCurrentOrderExists(customer); var orderEntries = customer.getOrderEntries(); foreach (var orderEntry in orderEntries) { currentStock.GetFromStock(orderEntry.ProductId, orderEntry.Qty); } TotalIncome += customer.TotalValue(); customer.Order = null; if (customer.Order == null) { Console.Write("order deleted"); } }
public void RemoveItemFromOrder(Customer customer, int productId, ulong qtyToRemove) { VerifyCurrentOrderExists(customer); var currentEntry = customer.getOrderEntries().Where(entry => entry.ProductId == productId) .SingleOrDefault(); if (currentEntry == null) { throw new ArgumentException("The given product is not in the order"); } if (qtyToRemove > currentEntry.Qty) { throw new ArgumentException("Too many products to remove.", "qtyToRemove"); } customer.Order.UpdateProductQty(productId, currentEntry.Qty - qtyToRemove); }
public IEnumerable <OrderEntry> ListOrderEntries(Customer customer) { return(customer.getOrderEntries()); }