title: how to use ModelState.IsValid in ASP.NET?
body: <p>Let's say I have a <code>Employee</code> class whose name field has to be string, but in the form submitted name is number 123 for example, I saw code like this:</p>
  
  <pre><code>UpdateModel(employee);
  if (ModelState.IsValid)
  {
     employeeBusinessLayer.SaveEmployee(employee);
  
     return RedirectToAction("Index");
  }
  </code></pre>
  
  <p>I don't quite understand how to use <code>ModelState.IsValid</code> here, I mean when it calls:</p>
  
  <pre><code>UpdateModel(employee);
  </code></pre>
  
  <p>It will throw an exception since employee's name can't be a number, if it doesn't throw exceptions, it means the model is valid, so why we still use <code>ModelState.IsValid</code>? Why not just use try catch block?</p>