title: How to check the original value of an attribute using MVC and EF
body: <p>Need to compare the original value with the current value in order to do some updates on objects prior to save changes. How to get the original value of an object? The following does not work:</p>
  
  <pre><code>public ActionResult Edit(int id = 0)
  {
      Project project = db.Projects.Find(id);
      ...
      db.Projects.Attach(project);  // ATTACH here
      ...
   }
  
   [HttpPost]
   public ActionResult Edit(Project project)
   {
       if (ModelState.IsValid)
       {
          db.Entry(project).State = EntityState.Modified;  // The STATE was DETACHED here...
          ...
    }
  </code></pre>
  
  <p>Is this a configuration issue, or did I miss something? Thanks in advance for any help!</p>