public static void AddProduct(string productName, int amount) { Product p = new Product { ProductID = GetNewID(), ProductName = productName, Amount = amount, }; Products.Add(p); }
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(); } }