Esempio n. 1
0
 public static void AddProduct(string productName, int amount)
 {
     Product p = new Product
     {
         ProductID = GetNewID(),
         ProductName = productName,
         Amount = amount,
     };
     Products.Add(p);
 }
Esempio n. 2
0
 public static void AddProduct(string productName,int amount) 
 {
     using (var context = new StockDbContext())
     {
         Product p = new Product
         {
             ProductID = GetNewID(),
             ProductName = productName,
             Amount = amount,
         };
         context.Products.Add(p);
         context.SaveChanges();
     }
 }