title: Generate list in view and pass it to controller
body: <p>I'm writing a hotel reservation web site with Asp.net and MVC 4.
  it have a class named reservation which have a list of contacts. in create view i want to dynamically create contacts. (number of contacts = adults + kids and it will be determined in create reservation view)
  how could i post contact information to controller?  </p>
  
  <pre><code>public partial class Reservation
  {
      public int Id { get; set; }
      public int RoomType_Id { get; set; }
      public System.DateTime FromDate { get; set; }
      public System.DateTime ToDate { get; set; }
      public byte Adults { get; set; }
      public byte Kids { get; set; }
      public decimal Price { get; set; }
      public int User_Id { get; set; }
      public int State_Id { get; set; }
      public virtual ReservationState ReservationState { get; set; }
      public virtual RoomType RoomType { get; set; }
      public virtual User User { get; set; }
      public virtual ICollection&lt;Transaction&gt; Transactions { get; set; }
      public virtual ICollection&lt;Contact&gt; Contacts { get; set; }
  }
  </code></pre>
  
  <p>should i set a maximum number for contacts(for example 5 and then write something like this?</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Create(Reservation reservation,Contact Adult1,Contact Adult2, Contact Adult3, Contact Adult4, Contact Adult5, Contact Kid1,Contact Kid2, Contact Kid3)
      {
          if(reservation.Adults&gt;0)
              reservation.Contacts.Add(Adult1);
          if(reservation.Adults&gt;1)
              reservation.Contacts.Add(Adult2);
          ...
          if (ModelState.IsValid)
          {
              _db.Reservations.Add(reservation);
              _db.SaveChanges();
              return RedirectToAction("Index");
          }
      }
  </code></pre>
  
  <p>it's very dirty is there a better way? can i pass list of contacts?</p>