Example #1
0
        private static void InsertSampleDataOnDatabase()
        {
            UserManager userManagerEf = new UserManager(new EfUserDal());

            if (userManagerEf.GetAll().Data.Count == 0)
            {
                UserManager userManagerMemory = new UserManager(new InMemoryUserDal());


                userManagerEf.AddRange(userManagerMemory.GetAll().Data);

                CustomerManager customerManagerMemory = new CustomerManager(new InMemoryCustomerDal());
                CustomerManager customerManagerEf     = new CustomerManager(new EfCustomerDal());

                customerManagerEf.AddRange(customerManagerMemory.GetAll().Data);

                ColorManager colorManagerMemory = new ColorManager(new InMemoryColorDal());
                ColorManager colorManagerEf     = new ColorManager(new EfColorDal());

                colorManagerEf.AddRange(colorManagerMemory.GetAll().Data);

                BrandManager brandManagerMemory = new BrandManager(new InMemoryBrandDal());
                BrandManager brandManagerEf     = new BrandManager(new EfBrandDal());

                brandManagerEf.AddRange(brandManagerMemory.GetAll().Data);

                CarManager carManagerMemory = new CarManager(new InMemoryCarDal());
                CarManager carManagerEf     = new CarManager(new EfCarDal());

                carManagerEf.AddRange(carManagerMemory.GetAll().Data);

                RentalManager rentalManagerMemory = new RentalManager(new InMemoryRentalDal());
                RentalManager rentalManagerEf     = new RentalManager(new EfRentalDal());

                rentalManagerEf.AddRange(rentalManagerMemory.GetAll().Data);

                Console.WriteLine("Örnek veriler yüklendi.");
            }
        }