Entity Framework: “Store update, insert, or delete statement affected an unexpected number of rows (0).”

I ran into this and it was caused by the entity’s ID (key) field not being set. Thus when the context went to save the data, it could not find an ID = 0. Be sure to place a break point in your update statement and verify that the entity’s ID has been set.
This issue is caused by forgetting to include the hidden ID input in the .cshtml edit page.