public void PlaceOrder(Order order) { try { Console.WriteLine("Handling order nr " + order.Id + " for " + order.Customer.Name + "..."); foreach (OrderItem item in order.Items) HandleOrderItem(item); // make it look like real work Thread.Sleep(TimeSpan.FromSeconds(1)); Console.WriteLine("Order nr " + order.Id + " handled"); } catch (Exception ex) { Console.WriteLine(ex); throw; } }
private static Order GenerateRandomOrder() { Order order = new Order { Id = random.Next(10000), Date = DateTime.Now, Customer = new Customer { Id = 1, Name = "Sophie" } }; order.Items.Add(new OrderItem { Quantity = random.Next(1, 5), Product = new Product { Id = random.Next(1, 3) } }); return order; }
public void ProcessOrder(Order order) { //TODO insert processing code here Console.WriteLine("Order nr " + order.Id + " handled"); }