title: Web API 2 does not process PATCH requests for Integers
body: <p>I'm having a problem with Web API 2 (.net 4.5.1) in that it seems to ignore PATCH requests where the property is an integer, but processes other types without a problem (I've tested string and decimal).</p>
  
  <p>I’ve setup an unsecured test API with a 'products' controller at <a href="http://playapi.azurewebsites.net/api/products" rel="noreferrer">http://playapi.azurewebsites.net/api/products</a>. If you do a GET to that URL, you’ll get something like this product back:</p>
  
  <pre><code>{"Id": 1,"Name": "Xbox One","Category": "gaming","Price": 300,"Stock": 5}
  </code></pre>
  
  <p>‘Name’ and ‘Category’ are both strings, ‘Price’ is a Decimal and ‘Stock’ is an Integer.</p>
  
  <p>If you send these requests, they both work (You’ll get a 200/OK with the updated entity):</p>
  
  <ul>
  <li>PATCH, <a href="http://playapi.azurewebsites.net/api/products/1" rel="noreferrer">http://playapi.azurewebsites.net/api/products/1</a> with <code>{"Price": 600.00}</code></li>
  <li>PATCH, <a href="http://playapi.azurewebsites.net/api/products/1" rel="noreferrer">http://playapi.azurewebsites.net/api/products/1</a> with
  <code>{"Category": "Electronics"}</code></li>
  </ul>
  
  <p>However, if you send this, it returns 200/OK, but does not make the update and the stock remains at the original value</p>
  
  <ul>
  <li>PATCH, <a href="http://playapi.azurewebsites.net/api/products/1" rel="noreferrer">http://playapi.azurewebsites.net/api/products/1</a> with
  <code>{"Stock": 4}</code></li>
  </ul>
  
  <p>My controller code is fairly standard boiler plate code (from the scaffolded ODATA controller but moved into a standard API controller):</p>
  
  <pre><code>// PATCH: api/Products/5
  [AcceptVerbs("PATCH", "MERGE")]
  public async Task&lt;IHttpActionResult&gt; PatchOrder(int id, Delta&lt;Product&gt; patch)
  {
      Validate(patch.GetEntity());
      if (!ModelState.IsValid)
      {
          return BadRequest(ModelState);
      }
      var item = await db.Products.FindAsync(id);
      if (item == null)
      {
          return NotFound();
      }
      patch.Patch(item);
      try
      {
          await db.SaveChangesAsync();
      }
      catch (DbUpdateConcurrencyException)
      {
          if (!ProductExists(id))
          {
              return NotFound();
          }
          else
          {
              throw;
          }
      }
      return Ok(item);
  }
  </code></pre>
  
  <p>My model for 'Product' is as follows:</p>
  
  <pre><code>namespace PlayAPI.Models
  {
      public class Product
      {
          [Key]
          public int Id { get; set; }
          public string Name { get; set; }
          public string Category { get; set; }
          public double Price { get; set; }
          public int Stock { get; set; }
      }
  }
  </code></pre>
  
  <p>When I debug the controller, I see that the ‘patch’ object has a <code>_changedProperties</code> collection which has no items in it when I do an integer request, but when I do any other kind of request it has the key that I changed.</p>
  
  <p>Should web API support PATCH requests for integer properties? If so, do I need to do anything special on the server or client to make it work?</p>