Esempio n. 1
0
 public static void CreateUsers(ShopContext context)
 {
     for (var i = 0; i < 200; i++)
     {
         context.Products.Add(new Product
         {
             Name = "Product" + i,
             Quantity = i + 1,
             Barcode = i.ToString()
         });
     }
     context.SaveChanges();
 }
Esempio n. 2
0
 public static void Initialize()
 {
     var context = new ShopContext();
     if (context.Products.Any()) return;
     CreateUsers(context);
 }