title: ViewModel is Null on HTTPPost
body: <p>I am new to MVC and I have been struggling with this problem for a few days now.
  <br/>
  <br/>
  When I am posting a form back to the server, the values are always null. I have tried using the model itself, using a collection/list, and the last approach I have tried was using a ViewModel.
  <br />
  <br />
  The Goal I'm trying to achieve is to mark attendance of events that users are signed up for. I am grabbing the correct Attend info and sending them to the view. I will select the check boxes to update the boolean value Attend.Attended. During debugging I'll put a break point at the beginning of the Post action, and the model, collection/list, ViewModel has been null everytime.
  <br />
  <br />
  Models:</p>
  
  <pre><code>public class Attend
  {
    [Key]
    public int AttendID { get; set; }
  
    public virtual UserProfile User { get; set; }
  
    public virtual Event Event { get; set; }
  
    public Boolean SignedUp { get; set; }
  
    public Boolean Attended {get; set; }
  
  }
  
  public class Event
  {
    [Key]
    public long EventID { get; set; }
  
    [Required]
    [DisplayName("When is this event?")]
    public DateTime DateScheduled { get; set; }
  
    public DateTime DateCreated { get; set; }
  
    [DisplayName("Event Category")]
    public String Category { get; set; }
  
    [Required]
    [DisplayName("Location")]
    public String Location { get; set; }
  
    public string Comments { get; set; }
  
    [Required]
    [DisplayName("Event Name")]
    public string EventName { get; set; }
  
    [Required]
    [DisplayName("Event Description")]
    public string EventDescription { get; set; }
  
    public virtual ICollection&lt;Attend&gt; Attends { get; set; }
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>    //
      // GET: /Event/Attendance
      [HttpGet]
      public ActionResult Attendance(long id)
      {
          try
          {
              var model = new AttendanceViewModel();
  
              if (db == null)
                  return HttpNotFound();
  
              if (Request.UrlReferrer != null &amp;&amp; Request.UrlReferrer.AbsoluteUri != null)
                  ViewBag.ReferrerUrl = Request.UrlReferrer.AbsoluteUri;
              else
                  ViewBag.ReferrerUrl = Url.Action("Index");
  
              model.Attending = db.Attends.ToList();
  
              ViewBag.myID = id;
              return View(model);
          }
          catch (Exception ex)
          {
              Log.Error(ex.Message, ex);
              return HttpNotFound();
          }
      }
  
      //
      // POST: /Event/Attendance
      [HttpPost]
      public ActionResult Attendance(AttendanceViewModel Attending, long id)
      {
  
         //POST ACTION...
      }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>model CottagesOfHope.ViewModels.AttendanceViewModel
  
  @{
      ViewBag.Title = "Attendance";
  }
  
  &lt;h2&gt;Mark Attendance&lt;/h2&gt;
  
  
  @using (Html.BeginForm())
  {
      &lt;fieldset&gt;
          &lt;legend&gt;Attendance&lt;/legend&gt;
          &lt;table&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Name&lt;/th&gt;
                      &lt;th&gt;Attendance&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  @foreach (var j in Model.Attending)
                  {
                      if (j.Event.EventID == ViewBag.myId)
                      {
                          &lt;tr&gt;
                             &lt;td&gt;@j.User.FirstName @j.User.LastName&lt;/td&gt;
                             &lt;td&gt;@Html.EditorFor(model =&gt; j.Attended)&lt;/td&gt;
                         &lt;/tr&gt;
                      }
                  }
              &lt;/tbody&gt;
          &lt;/table&gt;
          &lt;p&gt;
              &lt;input type="submit" value="Submit" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  }
  </code></pre>
  
  <p>ViewModel :</p>
  
  <pre><code>public class AttendanceViewModel
  {
      public virtual List&lt;Attend&gt; Attending { get; set; }
  }
  </code></pre>
  
  <p>Like I said before, this was the last approach I took trying to bind the data correctly. Any help would be greatly appreciated.
  <br/>
  Thanks in advance!</p>