public static void Initialize(PassengerDbContext context)
 {
     if (context.Database.EnsureCreated())
     {
         // Code to create initial data
         Seed(context);
     }
 }
        private static void Seed(PassengerDbContext context)
        {
            // Create list with dummy passengers
            List <Passenger> passengerList = new List <Passenger>
            {
                new Passenger()
                {
                    Name = "Jon Due", Email = "*****@*****.**"
                },
                new Passenger()
                {
                    Name = "Jon Due2", Email = "*****@*****.**"
                },
                new Passenger()
                {
                    Name = "Jon Due3", Email = "*****@*****.**"
                }
            };

            context.Passengers.AddRange(passengerList);
            context.SaveChanges();
        }
Esempio n. 3
0
        private static void Seed(PassengerDbContext context)
        {
            // Create list with dummy passengers
            List <Passenger> passengerList = new List <Passenger>
            {
                new Passenger()
                {
                    Name = "Juan Diaz", Email = "*****@*****.**"
                },
                new Passenger()
                {
                    Name = "Alberto Diaz", Email = "*****@*****.**"
                },
                new Passenger()
                {
                    Name = "Miguel Angel Diaz", Email = "*****@*****.**"
                }
            };

            context.Passengers.AddRange(passengerList);
            context.SaveChanges();
        }