Example #1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new NewCmsShoppingCartContext(serviceProvider.GetRequiredService <DbContextOptions <NewCmsShoppingCartContext> >()))
            {
                if (context.Pages.Any())
                {
                    return;
                }

                context.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();
            }
        }
Example #2
0
 public CategoriesController(NewCmsShoppingCartContext context)
 {
     this.context = context;
 }
Example #3
0
 public PagesController(NewCmsShoppingCartContext context)
 {
     this.context = context;
 }