title: Passing IEnumerable parameter to WebAPI
body: <p>I'm getting started with WebAPI and for the most part all is going well. I'm running into a problem with one particular function. This one differs from the other because it's only parameter is of type IEnumerable.</p>
  
  <p>I've set a breakpoint on the first line of the Post() function and I'm hitting the function but the "values" parameter ALWAYS has a count of 0. I verified that the parameter going in on the client side does, in fact, contain an array of integers. If I remove the [FromUri] attribute, the 'values' parameter is NULL instead of a count of 0.</p>
  
  <p><strong>How do I get my array of integers to come through on my WebAPI function?</strong></p>
  
  <p>Here's the WebAPI function:</p>
  
  <pre><code>[System.Web.Mvc.HttpPost]
  public void Post([FromUri] IEnumerable&lt;int&gt; values)
  {
      if (values == null || !values.Any()) return;
  
      int sortorder = 1;
      foreach (int photoId in values)
      {
          _horseRepository.UpdateSortOrder(photoId, sortorder);
          sortorder++;
      }
  }
  </code></pre>
  
  <p>Here's the AJAX call (this is using the jQuery UI Sortable feature):</p>
  
  <pre><code>$(".sortable").sortable({
      update: function (event, ui) {
                  var newArray = $(".sortable").sortable("toArray");
  
                  $.ajax({
                      url: '/api/photo',
                      type: 'POST',
                      contentType: 'application/json, charset=utf-8',
                      async: true,
                      dataType: 'json',
                      data: JSON.stringify(newArray),
                      complete: function (data) { }
                  });
              }
          });
  </code></pre>