internal void Update(Product product) { using (ETContext context = new ETContext()) { var entity = context.Entry(product); entity.State = EntityState.Modified; context.SaveChanges(); } }
internal void Delete(Product product) { using (ETContext context = new ETContext()) { // context.Products.Remove(product); var entity = context.Entry(product); entity.State = EntityState.Deleted; context.SaveChanges(); } }
internal void Add(Product product) { using (ETContext context = new ETContext()) { //context.Products.Add(product); var entity = context.Entry(product); entity.State = EntityState.Added; context.SaveChanges(); } }