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(); } }
public PosGreSqlDbContext Init() { return(dbContext ?? (dbContext = new PosGreSqlDbContext())); }