public void CreateProduct(Product newProduct)
 {
     Debug.WriteLine($"ProductsRepo> CreateProduct");
     // NOTE: The Id property must be explicitly set to 0 to create new object entry
     //       in the DB
     newProduct.Id = 0;
     _dbContext.Products.Add(newProduct);
     _dbContext.SaveChanges();
     Debug.WriteLine($"ProductsRepo> - Created product ID = {newProduct.Id}");
 }
示例#2
0
 public void Create(Supplier newDataObject)
 {
     _dbContext.Add(newDataObject);
     _dbContext.SaveChanges();
 }
示例#3
0
 public virtual void Create(T newDataObject)
 {
     _dbContext.Add <T>(newDataObject);
     _dbContext.SaveChanges();
 }