title: What does ModelState.IsValid do?
body: <p>When I do a create method i bind my object in the parameter and then I check if <code>ModelState</code> is valid so I add to the database:</p>
  
  <p>But when I need to change something before I add to the database (before I change it the <code>ModelState</code> couldn't be valid so I have to do it)
  why the model state still non valid.</p>
  
  <p>What does this function check exactly?</p>
  
  <p>This is my example:</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Create([Bind(Include = "EncaissementID,libelle,DateEncaissement,Montant,ProjetID,Description")] Encaissement encaissement) {
    encaissement.Montant = Convert.ToDecimal(encaissement.Montant);
    ViewBag.montant = encaissement.Montant;
    if (ModelState.IsValid) {
      db.Encaissements.Add(encaissement);
      db.SaveChanges();
      return RedirectToAction("Index", "Encaissement");
    };
    ViewBag.ProjetID = new SelectList(db.Projets, "ProjetId", "nomP");
    return View(encaissement);
  }
  </code></pre>