예제 #1
0
        }//AddCarDetails()

        public void SeedThis()
        {
            var car1 = new Car(5, "Kia", "Rio", "thermal", .1, .1, .1);

            _carRepo.AddCar(car1);

            var path     = @"passengerCars.csv";
            var seedFile = File.ReadAllLines(path);

            var content = seedFile.Skip(1).Select(c => c.Split(','))
                          .Select(c => new Car()
            {
                Id             = Convert.ToUInt16(c[0]),
                Make           = c[1],
                Model          = c[2],
                Propulsion     = c[3],
                Collision      = Convert.ToDouble(c[4]),
                Comprehensive  = Convert.ToDouble(c[5]),
                PersonalInjury = Convert.ToDouble(c[6]),
            }).ToList();


            _carRepo.AddCars(content); //add the list of cars from file
        }