Ejemplo n.º 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var contex = new CmsShopingCartContext(
                       serviceProvider.GetRequiredService <DbContextOptions <CmsShopingCartContext> >()))
            {
                if (contex.Pages.Any())
                {
                    return;
                }

                contex.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
                }
                    );
                contex.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 public PagesController(CmsShopingCartContext context)
 {
     this.context = context;
 }
 public CategoriesController(CmsShopingCartContext context)
 {
     this.context = context;
 }