public void CreateNewOrder()
        {
            // create a new order object
            var order = new Order()
            {
                Id = 1,
                OrderDate = DateTime.Now,
                OrderDetails = new List<OrderDetail>()
                {
                    new OrderDetail()
                    {
                        ProductId = 1,
                        Price = 100,
                        Quantity = 2
                    },
                    new OrderDetail()
                    {
                        ProductId = 3,
                        Price = 24,
                        Quantity = 1
                    },
                    new OrderDetail()
                    {
                        ProductId = 4,
                        Price = 15,
                        Quantity = 2
                    }

                }
            };

            StoreOrderInDb(order);
        }
 public void CreateInvoice(Order order)
 {
     _order = order;
     var orderTotal = order.OrderDetails.Sum(o => o.Quantity + o.Price);
     Console.WriteLine("Invoice created for {0}",orderTotal);
     // simulate fake billing process
     //if value is more than 1 assume billing did happen.
     OnBillingSuccessfullHandler(orderTotal >= 1);
 }
 public void StoreOrderInDb(Order order)
 {
     Console.WriteLine("saved order id {0} into the database", order.Id);
     // raise order created event
     OnOrderCreated(this, new OrderEventsArgs() { Order = order });
 }
 public void ShipOrder(Order order)
 {
     Console.WriteLine("Shipped order id: {0}", order.Id);
 }