title: WebAPI OData v4 Actions
body: <p>First off, I have this problem ...</p>
  
  <p><a href="https://stackoverflow.com/questions/27207450/webapi-odata-v4-comlextype-cannot-have-an-entitytype">WebApi OData v4 ComlexType cannot have an EntityType</a></p>
  
  <p>... having figured "that's rubbish but maybe I can work around it" I thought I might try telling OData that I am just returning a string and Json serialise the object myself ...</p>
  
  <p>Here's what i'd like to do</p>
  
  <pre><code>var acptBatch = Builder.EntityType&lt;ProposedOffer&gt;().Collection.Action("AcceptBatch");
  acptBatch.Parameter&lt;bool&gt;("asSingleTransaction");
  acptBatch.Parameter&lt;string&gt;("perspective");
  acptBatch.ReturnsCollection&lt;ValidationResult&lt;ProposedOffer&gt;&gt;();
  
  [HttpPost]
  [ODataRoute("AcceptBatch({asSingleTransaction},{perspective})")]
  public async Task&lt;IHttpActionResult&gt; AcceptBatch([FromUri]bool asSingleTransaction, [FromUri]string perspective, [FromBody]ICollection&lt;int&gt; offerIds)
  {
      try
      {
          var p = (Perspective)Enum.Parse(typeof(Perspective), perspective);
          var result = await Service.AcceptOffers(asSingleTransaction, offerIds, p);
  
          return Ok(result);
      }
      catch (Exception ex)
      {
          return await Failed(ex);
      }
  } 
  </code></pre>
  
  <p>having battled with it for a n hour or so already i've gotten this far ...</p>
  
  <pre><code>var acptBatch = Builder.EntityType&lt;ProposedOffer&gt;().Collection.Action("AcceptBatch");
  acptBatch.Parameter&lt;bool&gt;("asSingleTransaction");
  acptBatch.Parameter&lt;string&gt;("perspective");
  
  [HttpPost]
  [ODataRoute("AcceptBatch({asSingleTransaction},{perspective})")]
  [Route("ProposedOffer/AcceptBatch({asSingleTransaction},{perspective})")]
  public async Task&lt;IHttpActionResult&gt; AcceptBatch([FromUri]bool asSingleTransaction, [FromUri]string perspective)
  {
      try
      {
          var offerIds = JsonConvert.DeserializeObject&lt;ICollection&lt;int&gt;&gt;(await Request.Content.ReadAsStringAsync());
          var p = (Perspective)Enum.Parse(typeof(Perspective), perspective);
          var result = await Service.AcceptOffers(asSingleTransaction, offerIds, p);
  
          return Ok();
      }
      catch (Exception ex)
      {
          return await Failed(ex);
      }
  }
  </code></pre>
  
  <p>Anyone got any ideas how I can get my result back to the calling javascript based code on the client?
  At this point putting anything inside that Ok() results in the framework returning a 406 no matter how I declare it when initialising the model from what I can tell.</p>