You can attach an existing product
and set its state as Modified
.
If you are using the DbContext
API
context.Products.Attach(product); context.Entry(product).State = EntityState.Modified; context.SaveChanges();
For ObjectContext
context.Products.Attach(product); context.ObjectStateManager.ChangeObjectState(product, EntityState.Modified); context.SaveChanges();
source share