I'm using asp.net c# with entity framework and i have tried to delete a record from database. So for that i have coded the controller part as below.
public ActionResult DeleteAccount(DeleteAccountViewModel deleteaccountviewmodel)
TheFoodyContext db = new TheFoodyContext();
string UserEmail = Session["UserEmail"].ToString();
User user_to_update = db.Users.SingleOrDefault(s => s.email == UserEmail);
if (user_to_update != null)
if ((deleteaccountviewmodel.Password == user_to_update.password))
your code seems to be correct. db.SaveChanges(); will return value you can check whether it is removed or not. but you are mentioned 'Stores' not identified means if you are trying to delete record from Stores table use db.Stores.Remove() if not explain clearly your problem