private void CreateProducts(JinShopContext context) { if (context.Products.Count() == 0) { var listProduct = new List <Product>() { new Product() { Name = "A1", Description = "aaa" }, new Product() { Name = "1B", Description = "aaa" }, new Product() { Name = "C1", Description = "aaa" }, }; context.Products.AddRange(listProduct); context.SaveChanges(); } }
public void Add(TEntity entity) { _dbSet.Add(entity); _context.SaveChanges(); }
public void Create(Product product) { _dbSet.Add(product); _context.SaveChanges(); }