title: ASP.NET WebApi - how do I post a collection to a WebApi method?
body: <p>As I understand it, if I have an ASP.NET WebApi method whose signature looks like this...</p>
  
  <pre><code>public HttpResponseMessage PostCustomer(Customer customer) {
    // code to handle the POSTed customer goes here
  }
  </code></pre>
  
  <p>..then the WebApi model binding will look through the form collection and see if it has entries that match the names of the properties on the Customer class, and bind them to a new instance of the class, which gets passed in to the method.</p>
  
  <p>What if I want to allow some to POST a collection of objects? In other words, I want to have a WebApi method that looks like this...</p>
  
  <pre><code>public HttpResponseMessage PostCustomers(IEnumerable&lt;Customer&gt; customers) {
    // code to handle the POSTed customers goes here
  }
  </code></pre>
  
  <p>How would the calling code set up the POST?</p>
  
  <p>The same question applies if I want the Customer object to have a property that is a collection, say the customer's orders. How would the HTTP POST be set up?</p>
  
  <p>The reason for the question is that I want to write a controller that will allow someone using Delphi to POST information to my server. Don't know if that is relevant, but thought I better mention it in case. I can see how he could do this for a single object (see first code snippet), but can't see how he would do it for the collection.</p>
  
  <p>Anyone able to help?</p>