static void SeedProductionData(IServiceProvider services) { IConfiguration configuration = services.GetRequiredService <IConfiguration>(); AdminContext adminContext = services.GetRequiredService <AdminContext>(); if (adminContext.Admins.Count() == 0) { adminContext.Admins.Add(new Admin { Email = configuration["SeedData:AdminCredentials:Email"], Password = configuration["SeedData:AdminCredentials:Password"] }); adminContext.SaveChanges(); } }
static void SeedDevelopmentData(IServiceProvider services) { ClinicContext clinicContext = services.GetRequiredService <ClinicContext>(); AdminContext adminContext = services.GetRequiredService <AdminContext>(); clinicContext.Clinics.AddRange(new[] { new Clinic() { Name = "Clinic", Address = "There", Lat = 43.52f, Lng = -70.35f, WaitTime = 350000, Description = "Long form description goes here." }, new Clinic() { Name = "Clinic 2", Address = "Here", Lat = 43.55f, Lng = -70.33f, WaitTime = 3500000, Description = "Long form description goes here." } }); adminContext.Admins.Add(new Admin() { Email = "*****@*****.**", Password = "******" }); clinicContext.SaveChanges(); adminContext.SaveChanges(); }