public void SubmitButtonClick() { var customer = GetCustomerSubmittedInfo(); var order = GetOrderSubmittedInfo(); if (customer.Id == null) { ICustomerRepository customerRepo = new CustomerRepository(); customer.Id = customerRepo.CreateCustomer(customer); } order.CustomerId = customer.Id.Value; ITaxCalculationService taxCalculationService = new TaxCalculationService(); var taxRate = taxCalculationService.GetTaxRate(customer.Province); order.Items.ForEach(item => item.Taxes = item.Quantity * item.Price * taxRate); IOrderRepository orderRepository = new OrderRepository(); orderRepository.SaveOrder(order); IShippingService shippingService = new ShippingService(); var trackingNumber = shippingService.ShipOrder(order.OrderNumber); Console.WriteLine($"Thank you for your order. Your tracking number is {trackingNumber}"); Console.ReadKey(); }
private ShopFacade() { accountService = new AccountService(); paymentService = new PaymentService(); shippingService = new ShippingService(); emailService = new EmailService(); smsService = new SmsService(); }