コード例 #1
0
 private void CreatePostCategorySample(PosGreSqlDbContext context)
 {
     if (context.PostCategories.Count() == 0)
     {
         List <PostCategory> listPostCategory = new List <PostCategory>()
         {
             new PostCategory()
             {
                 Name = "Áo nam", Alias = "ao-nam", Status = true
             },
             new PostCategory()
             {
                 Name = "Áo nữ", Alias = "ao-nu", Status = true
             },
             new PostCategory()
             {
                 Name = "Giày nam", Alias = "giay-nam", Status = true
             },
             new PostCategory()
             {
                 Name = "Giày nữ", Alias = "giay-nu", Status = true
             }
         };
         context.PostCategories.AddRange(listPostCategory);
         context.SaveChanges();
     }
 }
コード例 #2
0
 public PosGreSqlDbContext Init()
 {
     return(dbContext ?? (dbContext = new PosGreSqlDbContext()));
 }