title: How to put conditional Required Attribute into class property to work with WEB API?
body: <p>I just want to put <strong>conditional Required Attribute</strong> which is work with <strong>WEB API</strong></p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>public sealed class EmployeeModel
  {
        [Required]
        public int CategoryId{ get; set; }
        public string Email{ get; set; } // If CategoryId == 1 then it is required
  }
  </code></pre>
  
  <p>I am using Model State validation via (<strong>ActionFilterAttribute</strong>)</p>