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}"); }
public void Create(Supplier newDataObject) { _dbContext.Add(newDataObject); _dbContext.SaveChanges(); }
public virtual void Create(T newDataObject) { _dbContext.Add <T>(newDataObject); _dbContext.SaveChanges(); }