Exemple #1
0
        private void SaveCars(IDataCollector dataCollector, IList <ModelSearchDto> bin, IServiceProvider serviceProvider, bool newCars)
        {
            AutoDbContext dbContext = serviceProvider.GetService <AutoDbContext>();

            foreach (ModelSearchDto model in bin)
            {
                IEnumerable <Car> cars = dataCollector.GetAllCars(model, newCars);

                foreach (Car car in cars)
                {
                    dbContext.Cars.Add(car);
                }

                dbContext.SaveChanges();
            }
        }