Пример #1
0
        public ICollection <Customer> GetCustomersAndTheirOrders()
        {
            IList <Customer> result = new List <Customer>();
            var customerList        = CustomerRepository.LoadCustomers();

            // Get the orders for each customer
            foreach (Customer customer in customerList)
            {
                customer.CustomerOrders = orderRepository.LoadOrdersByCustomer(customer.CustomerId);
                result.Add(customer);
            }

            // Return a list of customers with their orders added to their CustomerOrders collections.
            return(result);
        }
Пример #2
0
 public ICollection <Order> LoadOrdersByCustomer(int customerId)
 {
     return(orderRepository.LoadOrdersByCustomer(customerId));
 }