Example #1
0
        private static void GearboxesSeeding()
        {
            var json = File.ReadAllText("CarGearboxJsonImporterFile.json");

            var properties = JsonSerializer.Deserialize <IEnumerable <FuelTypeDto> >(json);

            var db = new CarDealerDbContext();

            ICarsService carservice = new CarsService(db);

            foreach (var property in properties)
            {
                try
                {
                    carservice.AddGearbox(property.Name);
                }
                catch
                {
                }
            }
        }