public void Update(Product entity) { using (NortwindContext context = new NortwindContext()) { var updatedEntity = context.Entry(entity); updatedEntity.State = EntityState.Modified; context.SaveChanges(); } }
public void Delete(Product entity) { using (NortwindContext context = new NortwindContext()) { var deletedEntity = context.Entry(entity); deletedEntity.State = EntityState.Deleted; context.SaveChanges(); } }
public void Add(Product entity) { using (NortwindContext context = new NortwindContext()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; context.SaveChanges(); } }
public void Add(Product entity) { //IDisponsible pattern implementation of c# using (NortwindContext context = new NortwindContext()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; context.SaveChanges(); } }
public void Add(Product entity) { //using bittikten sonra garbage cloolector hemen bellekten siler //IDispossable patterne implementation od c# using (NortwindContext context = new NortwindContext()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; context.SaveChanges(); } }