title: MVC4 Model Validation Server Side in API Controller
body: <p>I've got an admin view and on part of the view are a few text boxes for registering new users. I'm using a RegisterModel class as part of my view model so that I get all the client side validation, but I'm stopping the form submit using jquery, confirming validation client side using jquery, then sending the model to an API controller with ajax.</p>
  
  <p>Here's a stripped down version of my RegisterModel.</p>
  
  <pre><code>[Required(ErrorMessage = "User Name Required")]
  public string UserName { get; set; }
  [Required(ErrorMessage = "Email Required")]
  [RegularExpression("REGEX", ErrorMessage = "Invalid Email")]
  public string Email { get; set; }
  [Required(ErrorMessage = "Password Required")]
  public string Password { get; set; }
  [Compare("Password", ErrorMessage = "Passwords do not match")]
  public string ConfirmPassword { get; set; }
  </code></pre>
  
  <p>Here's the start of my Register method in my API controller:</p>
  
  <pre><code>[HttpPost]
  public void Register (RegisterModel newUser)
  {
     // Validate User
  
  }
  </code></pre>
  
  <p>How can I take advantage of all my data annotations and validate my model in my API controller? Something like newUser.Validate();</p>