title: How to implement an identical POST like the regular PUT in an odata controller to update an entity
body: <p>Given the following typical implementation of an ODataController's <a href="https://docs.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint#update-an-entity" rel="nofollow noreferrer">PUT method</a>, how would I make the exact same method ALSO be available as a POST?</p>
  
  <p>I am developing an OData end-point that will be called from an external system that I have no control over. It appears that that system implements the Update semantics (to tell my system to update an entity) wrongly by sending a POST with a uri key instead of using a PUT.</p>
  
  <pre class="lang-cs prettyprint-override"><code>public async Task&lt;IHttpActionResult&gt; Put([FromODataUri] int key, Product update)
  {
      if (!ModelState.IsValid)
      {
          return BadRequest(ModelState);
      }
      if (key != update.Id)
      {
          return BadRequest();
      }
      db.Entry(update).State = EntityState.Modified;
      try
      {
          await db.SaveChangesAsync();
      }
      catch (DbUpdateConcurrencyException)
      {
          if (!ProductExists(key))
          {
              return NotFound();
          }
          else
          {
              throw;
          }
      }
      return Updated(update);
  }
  </code></pre>
  
  <p>My first guess was to annotate the method with [AcceptVerbs("PUT", "POST")] to make the same exact method implementation be available as a POST, but that doesn't work.  It's probably that the ODataConventionModelBuilder default setup doesn't know about this...</p>
  
  <p>Ideally I'd like to keep the standards based PUT and the regular POST for inserts, but add a special post that is identical to the put but differs only in the verb.</p>
  
  <p>Thanks</p>