title: ASP.NET MVC/Web API model binding item to collection
body: <p>I am using Web API as the entry points for an ExtJS data store, where autosync is enabled in batch mode. This means that my defined Web API method can either be called with just 1 item or a collection of items, as described below.</p>
  
  <p>Case with only 1 item:</p>
  
  <pre><code>{  
   "Category":"fsf",
   "Importance":10,
   "TaskNo":5467,
   "Id":"UnplannedTask-6",
   "StartDate":"2015-09-21T03:00:00+02:00",
   "EndDate":"2015-09-21T05:00:00+02:00",
   "Cls":"",
   "Name":"",
   "ResourceId":"18"
  }
  </code></pre>
  
  <p>Case with multiple items:</p>
  
  <pre><code>[  
    {  
      "Category":"haer",
      "Importance":10,
      "TaskNo":5,
      "Id":"UnplannedTask-5",
      "StartDate":"2015-09-21T04:00:00+02:00",
      "EndDate":"2015-09-21T06:00:00+02:00",
      "Cls":"",
      "Name":"",
      "ResourceId":"14"
   },
   {  
    "Category":"fsf",
    "Importance":10,
    "TaskNo":5467,
    "Id":"UnplannedTask-6",
    "StartDate":"2015-09-21T03:00:00+02:00",
    "EndDate":"2015-09-21T05:00:00+02:00",
    "Cls":"",
    "Name":"",
    "ResourceId":"18"
    }
   ]
  </code></pre>
  
  <p>This is causing some issues for my Web API, as I have noticed overloading is somewhat tricky (perhaps impossible). </p>
  
  <p>Here is the Web API action that accepts a list of items:</p>
  
  <pre><code>  [HttpPost]
    public async Task&lt;dynamic&gt; Update(IEnumerable&lt;Appointment&gt; appointments)
    {
     ...
    }
  </code></pre>
  
  <p>Here it is once more in the scenario that it only accepts one:</p>
  
  <pre><code> [HttpPost]
    public async Task&lt;dynamic&gt; Update(Appointment appointment)
    {
     ...
    }
  </code></pre>
  
  <p>Now, both actions work individually. When only one item comes back, the model binding is correct. Same story for when a list is sent back. So far so good.
  It is however impossible to know whether 1 item or 10 items will be sent across the wire. So I have to be able to suppport both actions, but overloading doesn't work in this way I have experienced - which means I can only use one action at a time.</p>
  
  <p>So I was hoping for a solution where I could use model binding to convert the binding for 1 item to a collection of items, so that I can use only 1 action that accepts a list of items. Is this possible and are there any examples (and time savers) available?</p>