Exemplo n.º 1
0
 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();
     }
 }
Exemplo n.º 2
0
 public void Add(TEntity entity)
 {
     _dbSet.Add(entity);
     _context.SaveChanges();
 }
Exemplo n.º 3
0
 public void Create(Product product)
 {
     _dbSet.Add(product);
     _context.SaveChanges();
 }