Example #1
0
        public Order PlaceOrder(Order order, int customerId)
        {
            Customer customer = CustomerRepository.Load(customerId);

            if (order.Amount == 0)
            {
                return(null);
            }

            CalculateVatByCountry(customer, order);

            order.CustomerId = customerId;

            var result = _orderRepository.Save(order);

            return(result);
        }
Example #2
0
        public bool PlaceOrder(Order order, Guid customerId)
        {
            Customer customer = CustomerRepository.Load(customerId);

            if (order.Amount == 0)
            {
                return(false);
            }

            if (customer.Country == "UK")
            {
                order.VAT = 0.2d;
            }
            else
            {
                order.VAT = 0;
            }

            order.CustomerId = customerId;

            orderRepository.Save(order);

            return(true);
        }
        public Customer Load(int customerId)
        {
            Customer customer = CustomerRepository.Load(customerId);

            return(customer);
        }