public void Add(Product entity) { var addedEntity = _eTradeContext.Entry(entity); addedEntity.State = EntityState.Added; _eTradeContext.SaveChanges(); }
public void Delete(Product product) { using (ETradeContext context = new ETradeContext()) { var entity = context.Entry(product); entity.State = EntityState.Deleted; context.SaveChanges(); } }