Пример #1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new CapTestAutomationDemoContext(
                       serviceProvider.GetRequiredService <DbContextOptions <CapTestAutomationDemoContext> >()))
            {
                if (context.VehiclesModel.Any())
                {
                    return;
                }

                context.VehiclesModel.AddRange(
                    new VehiclesModel
                {
                    Year             = DateTime.Parse("2017"),
                    Make             = "Honda",
                    CarModel         = "Jazz",
                    BodyStyle        = "Hatchback",
                    FuelType         = "petrol",
                    EngineSize       = 1.5d,
                    InsurancePackage = 3
                },

                    new VehiclesModel
                {
                    Year             = DateTime.Parse("2014"),
                    Make             = "Audi",
                    CarModel         = "A6",
                    BodyStyle        = "Sedan",
                    FuelType         = "diesel",
                    EngineSize       = 2.0d,
                    InsurancePackage = 3
                },

                    new VehiclesModel
                {
                    Year             = DateTime.Parse("2007"),
                    Make             = "Suzuki",
                    CarModel         = "SX4",
                    BodyStyle        = "Hatchback",
                    FuelType         = "diesel",
                    EngineSize       = 1.6d,
                    InsurancePackage = 2
                });
                context.SaveChanges();
            }
        }
 public DetailsModel(CapTestAutomationDemo.Models.CapTestAutomationDemoContext context)
 {
     _context = context;
 }
Пример #3
0
 public IndexModel(CapTestAutomationDemo.Models.CapTestAutomationDemoContext context)
 {
     _context = context;
 }
 public CreateModel(CapTestAutomationDemo.Models.CapTestAutomationDemoContext context)
 {
     _context = context;
 }