title: Web API 2.0 Exception Handling
body: <p>I am using Web API 2.0 to create my own project.
  My Api contain ability to Add , Get and book product.</p>
  
  <p>I Want to handle exception but there is some issue I little bit confused.</p>
  
  <p>I have a controller: <code>ProdctController</code> with action method <code>AddProdct</code>.</p>
  
  <pre><code>   [Route("~/CKService.svc/author/add")]
      [HttpPost]
      public IHttpActionResult AddProduct(ProductRequest request)
      {
          ProductManager.AddProduct(request.ProductId, request.ProductName, 
          request.Price);
  
          return Ok(new AddProductResponse()
          {
              Status = AddProductStatus.Success
          };)
      }
  </code></pre>
  
  <p>Now, if the product already exists, so the data access layer will throw <code>DuplicateKeyException</code></p>
  
  <p>I want to handle this excpetion and return response like this:</p>
  
  <pre><code>  return Ok(new AddProductResponse()
      {
          Status = AddProductStatus.AlreadyExists
      };)
  </code></pre>
  
  <ol>
  <li>Is this reasonable to return <code>HTTP status code 200</code>?</li>
  <li>How can I do this without add <code>catch DuplicateKeyException</code> to my controller because i think this is not the right way.</li>
  </ol>
  
  <p>Thanks</p>