title: Validating model sent to Web API controller
body: <p>In a call to Web  API service I have following class properties that I need to send to its controller method:</p>
  
  <pre><code>public class FindBookingRequestModel 
  {
      public string ReservationNumber { get; set; }
      public string CreditCardNumber { get; set; }
      public string EmailAddress { get; set; }
      public string Origin { get; set; }
      public string Destination { get; set; }
      public DateTime? StartDate { get; set; }
  }
  </code></pre>
  
  <p>Per use case, I have three scenarios where I need to validate model sent to web api controller and to assure that folowing class properties are populated, othervise I need to throw BadRequest exception.</p>
  
  <ol>
  <li><p>use case:</p>
  
  <pre><code>{
      "ReservationNumber": "WERTSDFFSDF",
      "CreditCardNumber" : "3333"
  }   
  </code></pre></li>
  <li><p>use case</p>
  
  <pre><code>{
      "ReservationNumber" : "WERTSDFFSDF",
      "EmailAddress" : "somene@gmail",
      "Origin" : "FRA",
      "Destination" : "MUN"
  }
  </code></pre></li>
  <li><p>use case </p>
  
  <pre><code>{
      "StartDate" : "2015-12-15",
      "EmailAddress" : "somene@gmail",
      "Origin" : "FRA",
      "Destination" : "MUN"
  }
  </code></pre></li>
  </ol>
  
  <p>So it should be an error if we send this model to controller:</p>
  
  <pre><code>{
      "ReservationNumber": "WERTSDFFSDF",
      "Origin" : "FRA",
  } 
  </code></pre>
  
  <p>or this one:</p>
  
  <pre><code>{
      "EmailAddress" : "somene@gmail",
       "StartDate" : "2015-12-15",
  }
  </code></pre>
  
  <p>What is the most efficient way to ensure that fields are passed as stated in use cases above?</p>