using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcApplication1.Models
{
    public class Repository
    {
        public static Repository repository = new Repository();

        public IEnumerable<Customer> GetCustomersList() 
        {
            Random random = new Random();

            for (int i = 0; i < random.Next(20); i++) 
            {
                yield return new Customer { ID = i, Name = "Customer" + i, Orders = GetOrdersList(random) };
            }
        }

        private IEnumerable<CustomOrder> GetCustomOrdersList(Random random)
        {
            for (int i = 0; i < random.Next(10); i++)
            {
                yield return new CustomOrder { ID = i, CustomName = "CustomName" + i };
            }
        }

        private IEnumerable<Order> GetOrdersList(Random random) 
        {
            for (int i = 0; i < random.Next(10); i++)
            {
                yield return new Order { ID = i, Name = "Order" + i, CustomOrders = GetCustomOrdersList(random)};
            }
        }
    }
}
