An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key

As mentioned by @anon you can’t attach model once you loaded the entity with the same key. The changes must be applied to attached entity. Instead of this:

db.Entry(model).State = EntityState.Modified;

use this:


Leave a Comment