示例#1
0
        public void AddOrder(string name, List<Item> items)
        {
            Customer user = new Customer(name);
            user.Orders.Add(new Order(items));

            Customers.Add(user);
        }
示例#2
0
 public void AddOrder(Customer who, List<Item> items)
 {
     int index = Customers.FindIndex(x => x.Id == who.Id);
     if (index != -1)
     {
         Customer user = Customers.ElementAt(index);
         user.Orders.Add(new Order(items));
         Customers.Insert(index, user);
     }
     else
     {
         who.Orders.Add(new Order(items));
         Customers.Add(who);
     }
 }