private void CreateProductExample(TrainingShopDbContext context) { if (context.Products.Count() == 0) { var listProduct = new List <Product>() { new Product() { Name = "Quạt hơi 1", Alias = "quat-hoi-1", Status = true, CategoryID = 4 }, new Product() { Name = "Quạt hơi 2", Alias = "quat-hoi-2", Status = true, CategoryID = 4 }, new Product() { Name = "Quạt hơi 3", Alias = "quat-hoi-3", Status = true, CategoryID = 4 }, new Product() { Name = "Quạt hơi 4", Alias = "quat-hoi-4", Status = true, CategoryID = 4 } }; context.Products.AddRange(listProduct); context.SaveChanges(); } }
private void CreateProductCategoryExample(TrainingShopDbContext context) { if (context.ProductCategories.Count() == 0) { var listProductCategory = new List <ProductCategory>() { new ProductCategory() { Name = "Điện Lạnh", Alias = "dien-lanh", Status = true }, new ProductCategory() { Name = "Viễn Thông", Alias = "Vien-thong", Status = true }, new ProductCategory() { Name = "Đồ Gia Dụng", Alias = "do-gia-dung", Status = true }, new ProductCategory() { Name = "Mỹ Phẩm", Alias = "my-pham", Status = true } }; context.ProductCategories.AddRange(listProductCategory); context.SaveChanges(); } }
public TrainingShopDbContext Init() { return(dbContext ?? (dbContext = new TrainingShopDbContext())); }
public ApplicationUserStore(TrainingShopDbContext context) : base(context) { }