title: Getting error foreach statement cannot operate on variables of type '' because '' does not contain a public definition for 'GetEnumerator'
body: <p>I am getting an error here in my razor view:</p>
  
  <blockquote>
    <p>foreach statement cannot operate on variables of type
    'Project.Model.ResultsClass' because 'Project.Model.ResultsClass' does
    not contain a public definition for 'GetEnumerator'</p>
  </blockquote>
  
  <p>Here is my <code>foreach</code> and how I am defining <code>Model</code></p>
  
  <pre><code>@model Project.Models.ResultsClass
  
  @foreach (var item in Model) {
  }
  </code></pre>
  
  <p>Here is the controller method:</p>
  
  <pre><code>public ActionResult Results()
  {
      var results = db.Data.SqlQuery("SELECT * FROM Results").ToList();
      ResultsClass result = new ResultsClass();
  
      result.previewID = results[0].id;
      result.dateSlot = results[0].dateSlot;
      result.timeSlot = results[0].timeSlot;
      result.startTime = results[0].startTime;
      result.dateCreated = results[0].dateCreated;
  
      return View(result);
  }
  </code></pre>
  
  <p>And Here is my class:</p>
  
  <pre><code>public class ResultsClass
  {
      [DisplayName("Preview ID")]
      public int previewID { get; set; }
      [DisplayName("Date")]
      public string dateSlot { get; set; }
      [DisplayName("Time")]
      public string timeSlot { get; set; }
      [DisplayName("Start Time")]
      public DateTime startTime { get; set; }
      [DisplayName("Completed Time")]
      public DateTime dateCreated { get; set; }
  }
  </code></pre>
  
  <p>I don't understand what I am doing wrong?</p>