Exemple #1
0
 public static void Initialize(IServiceProvider serviceProvider)
 {
     using (var context = new GalileuszSchoolContext(serviceProvider.GetRequiredService <DbContextOptions <GalileuszSchoolContext> >()))
     {
         if (context.Pages.Any())
         {
             return;
         }
         context.Pages.AddRange(
             new Page
         {
             Title   = "Home",
             Slug    = "home",
             Content = "home page",
             Sorting = 0
         },
             new Page
         {
             Title   = "About Us",
             Slug    = "about-us",
             Content = "about us page",
             Sorting = 100
         },
             new Page
         {
             Title   = "Services",
             Slug    = "services",
             Content = "services page",
             Sorting = 100
         },
             new Page
         {
             Title   = "Contact",
             Slug    = "contact",
             Content = "contact page",
             Sorting = 100
         }
             );
         context.SaveChanges();
     }
 }
Exemple #2
0
 public static void InitializeDbForTests(GalileuszSchoolContext db)
 {
     db.CalendarEvents.AddRange(GetSeedingCalendarEvents());
     db.SaveChanges();
 }