Пример #1
0
        public bool PlaceOrder(Order order, int customerId)
        {
            var customer = _unitofWork.GetCustomer(customerId);

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

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

            var newOrder = _unitofWork.SaveOrder(
                new NewOrder
            {
                Amount      = order.Amount,
                CustomerId  = customerId,
                OrderNumber = order.OrderNumber,
                VAT         = order.VAT
            });

            return(newOrder);
        }