Пример #1
0
        private static void PlaceOrder()
        {
            var customer = new Customer();
            //populate customer

            var order = new Order();
            //populate order

            var payment = new Payment();
            //populate payment info from the UI

            var orderController = new OrderController();

            orderController.PlaceOrder(
                customer,
                order,
                payment,
                allowSplitOrders:true,
                emailReceipt:true);
        }
Пример #2
0
        public void PlaceOrder(
            Customer customer, 
            Order order, 
            Payment payment, 
            bool allowSplitOrders, 
            bool emailReceipt)
        {
            CustomerRepository.Add(customer);

            OrderRepository.Add(order);

            InventoryRepository.OrderItems(order, allowSplitOrders);

            payment.ProcessPayment();

            if (emailReceipt)
            {
                customer.ValidateEmail();
                CustomerRepository.Update();

                EmailLibrary.SendEmail(customer.EmailAddress, "Here's the receipt");
            }
        }
 public void Add(Customer customer)
 {
 }