title: MVC 4 postback empty viewmodel
body: <p>Ok so there are lots of questions regarding this, but I can't seem to get this to work. It should be simple, but I'm left scratching my head.</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>[HttpPost]
  public ActionResult Edit(BookingIndexViewModel vm) // Also tried BookingViewModel
  {
      return View();
  }
  </code></pre>
  
  <p><strong>Container view model:</strong></p>
  
  <pre><code>public class BookingIndexViewModel
  {
      public int id { get; set; }
  
      public List&lt;BookingViewModel&gt; bookings { get; set; }
      public List&lt;SelectListItem&gt; allAttendances { get; set; }
  }
  </code></pre>
  
  <p><strong>Booking view model</strong> (the VM I'm actually interested in)</p>
  
  <pre><code>public class BookingViewModel
  {
      public int id { get; set; }
      public int referralId { get; set; }
      public int attendanceId { get; set; }
  }
  </code></pre>
  
  <p><strong>The View</strong></p>
  
  <pre><code>@model Project.ViewModels.BookingIndexViewModel
  @using Project.ViewModels
  
  &lt;fieldset&gt;
      &lt;legend&gt;Registered patients&lt;/legend&gt;
      @if (Model.bookings.Count &lt; 1)
      {
          &lt;div&gt;None currently registered&lt;/div&gt;
      }
      else
      {
      &lt;table&gt;
          &lt;tr&gt;
              &lt;th&gt;
                  &lt;span class="display-label"&gt;@Html.LabelFor(model =&gt; model.bookings[0].forenames)&lt;/span&gt;
              &lt;/th&gt;
              &lt;th&gt;
                  &lt;span class="display-label"&gt;@Html.LabelFor(model =&gt; model.bookings[0].surname)&lt;/span&gt;
              &lt;/th&gt;
              &lt;th&gt;
                  &lt;span class="display-label"&gt;@Html.LabelFor(model =&gt; model.bookings[0].dob)&lt;/span&gt;
              &lt;/th&gt;
              &lt;th&gt;
                  &lt;span class="display-label"&gt;@Html.LabelFor(model =&gt; model.bookings[0].attendance&lt;/span&gt;
              &lt;/th&gt;
          &lt;/tr&gt;
  
          @{
              foreach (BookingViewModel b in Model.bookings)
              {
                  using (Html.BeginForm("Edit", "Booking"))
                  {
                      @Html.HiddenFor(x =&gt; x.id)
                      &lt;tr&gt;
                          &lt;td&gt;
                              &lt;span class="display-field"&gt;@b.forenames&lt;/span&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;span class="display-field"&gt;@b.surname&lt;/span&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;span class="display-field"&gt;@String.Format("{0:dd/MM/yyyy}", b.dob)&lt;/span&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              @Html.DropDownListFor(model =&gt; b.attendanceStatusId, Model.allAttendances)
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;input type="submit" value="Save" /&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  }
              }
          }
      &lt;/table&gt;
      }
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>So the view accepts the container view model <code>BookingIndexViewModel</code> and creates a form for each <code>BookingViewModel</code> held. When submitted I expect it to pass back the container view model with the modified <code>BookingViewModel</code> but it's always empty. I've also tried expecting the single <code>BookingViewModel</code> that is modified with the same result. Does MVC submit a hydrated view model of the same type as the type given to the view or the type inferred from within the form block?</p>
  
  <p>The only values of importance that I retrieve from the view is the modified <code>attendanceId</code> (that should be filled by the dropdown helper) and the booking id.</p>