Core.Model.Customer.AddOrder C# (CSharp) Method

AddOrder() public method

public AddOrder ( Order order ) : void
order Order
return void
        public void AddOrder(Order order)
        {
            order.Customer = this;
            _orders.Add(order);
        }

Usage Example

        private static Customer GetCustomerGraph()
        {
            var product = new Product {Price = 10m};

            var order = new Order
                            {
                                Status = OrderStatus.Shipped,
                                ShipDate = new DateTime(2010, 1, 2)
                            };

            order.AddOrderLine(2, product);

            var order1 = new Order
                         	{
                         		Status = OrderStatus.Shipped,
                         		ShipDate = new DateTime(2010, 1, 1)
                         	};

            order1.AddOrderLine(3, product);

            var customer = new Customer
                           	{
                           		Status = CustomerStatus.Normal,
                           		Name = new Name {First = "Joe", Last = "Smith"}
                           	};

            customer.AddOrder(order);
            customer.AddOrder(order1);

            return customer;
        }
All Usage Examples Of Core.Model.Customer::AddOrder