title: C# MVC context.SaveChanges() do not persist data in database
body: <p>I´ve tried everything, read several questions here, but my code is still not working, and I can´t figure out what I´m doing wrong. The field 'liberado' in database doesn´t change to '1' after the code runned, and I get no errors. Thanks a lot.</p>
  <pre><code>[HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Release(int id)
      {
          Publicacao publicacao =  db.Publicacao.Find(id);
          //Publicacao publicacao = db.Publicacao.Where(a =&gt; a.idpublicacao == id).First();
          if (publicacao == null)
          {
              return RedirectToAction(&quot;Index&quot;);
          }
          db.Publicacao.Attach(publicacao);
          db.Entry(publicacao).State = EntityState.Modified;
          publicacao.liberado = 1;
          db.SaveChanges();
          return RedirectToAction(&quot;Index&quot;);
      } 
  </code></pre>
  <p>The model</p>
  <pre><code> public partial class Publicacao
      {
          public int idpublicacao { get; set; }
          public string titulo { get; set; }
          public string texto { get; set; }
          public string imagem { get; set; }
          public System.DateTime data { get; set; }
          public int categoria { get; set; }
          public byte[] arqimagem { get; set; }
          public string descimagem { get; set; }
          public Nullable&lt;int&gt; usuario { get; set; }
          public int liberado { get; set; }
      
          public virtual categoria categoria1 { get; set; }
          public virtual Users Users { get; set; }
      }
  </code></pre>