public void Update(Entities.Concrete.Product entity) { using (NorthwindContext context = new NorthwindContext()) { var updatedEntity = context.Entry(entity); updatedEntity.State = EntityState.Modified; context.SaveChanges(); } }
public void Add(Entities.Concrete.Product entity) { //Belleği hızlıca temizleme using (NorthwindContext context = new NorthwindContext()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; context.SaveChanges(); } }