title: mvc3 model does not contain definition for GetEnumerator
body: <p>This is the controller. 
  what I need is to access the IList named model in the view. I want to display Barcode and ImageUrl.</p>
  
  <pre><code>using BezoekerSysteem.Models;
  using System.Data.SqlClient;
  using System.Web.Mvc;
  using System.Data;
  using System;
  using System.Collections.Generic;
  
  namespace BezoekerSysteem.Controllers
  {
      public class HomeController : Controller
      {
  
  public ActionResult PrintPage()
              {
                  SqlConnection con = new SqlConnection("");
                  string query = "select * From visitors";
                  DataTable dt = new DataTable();
                  con.Open();
                  SqlDataAdapter sda = new SqlDataAdapter(query, con);
                  sda.Fill(dt);
                  con.Close();
                  IList&lt;VisitorResponse&gt; model = new List&lt;VisitorResponse&gt;();
                  for (int i = 0; i &lt; dt.Rows.Count; i++)
                  {
                      var p = dt.Rows[i]["BarCodeImage"];
                      model.Add(new VisitorResponse()
                      {
                          Barcode = dt.Rows[i]["Barcode"].ToString(),
                          ImageUrl = dt.Rows[i]["BarCodeImage"] != null ? "data:image/jpg;base64," + Convert.ToBase64String((byte[])dt.Rows[i]["BarCodeImage"]) : ""
                      });
                  }
                  return View(model);
              }
  }
  </code></pre>
  
  <p><strong>This is the model</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace BezoekerSysteem.Models
  {
      public class VisitorResponse
      {
          public byte[] BarcodeImage      { get; set; }
          public string Barcode           { get; set; }
          public string ImageUrl          { get; set; }
      }
  }
  </code></pre>
  
  <p>This is what I tryed.</p>
  
  <pre><code>@model BezoekerSysteem.Models.VisitorResponse
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
      &lt;body&gt;
              &lt;div&gt;
              @foreach (var item in Model) {
                    @Html.DisplayFor(modelItem =&gt; item.Barcode) &lt;br /&gt;
  
                    &lt;img src="@item.ImageUrl"/&gt;
                  }    
              &lt;/div&gt;      
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>error message: </p>
  
  <pre><code>foreach statement cannot operate on variables of type 'BezoekerSysteem.Models.VisitorResponse' because 'BezoekerSysteem.Models.VisitorResponse' does not contain a public definition for 'GetEnumerator'
  </code></pre>
  
  <p>I also tryed to change this.</p>
  
  <pre><code>@model BezoekerSysteem.Models.VisitorResponse
  </code></pre>
  
  <p>In to this.</p>
  
  <pre><code>@model IEnumerable&lt;BezoekerSysteem.Models.VisitorResponse&gt;
  </code></pre>
  
  <p>Then I got no errors in visual studio but when I run it I get an error in my browser</p>
  
  <pre><code>The model item passed into the dictionary is of type 'BezoekerSysteem.Models.VisitorResponse', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[BezoekerSysteem.Models.VisitorResponse]'.
  </code></pre>