title: View Error @Foreach (var item...) Model/Controller/View
body: <p>Heey, </p>
  
  <p>I have a problem which seems stupid but i just can't fix it, and i dont know why i think im overlooking it so i need a new set of eyes.</p>
  
  <p>I Got a model Class:</p>
  
  <pre><code>namespace LaatsteStudentWebAPI.Models
  {
      public class Student
      {
          public int StudenNr { get; set; }
          public string Naam { get; set; }
          public string Woonplaats { get; set; }
          public string Adres { get; set; }
          public int TelefoonNr { get; set; }
          public string School { get; set; }
      }
  }
  </code></pre>
  
  <p>And a Controller:</p>
  
  <pre><code>namespace LaatsteStudentWebAPI.Controllers
  {
      public class ArticleController : Controller
      {
          private List&lt;Student&gt; students = new List&lt;Student&gt;();
          private int _nextId = 1;
          SqlConnection con;
          SqlDataAdapter da;
          DataSet ds = new DataSet();
  
          public ActionResult Index()
          {
              SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
              da = new SqlDataAdapter("SELECT StudentNr, Naam, Woonplaats, Adres, TelefoonNr, School FROM [Table] ORDER BY StudentNr DESC", con);
              da.Fill(ds);
              foreach (DataRow dr in ds.Tables[0].Rows)
              {
                  students.Add(new Student() { StudenNr = int.Parse(dr[0].ToString()), Naam = dr[1].ToString(), Woonplaats = dr[2].ToString(), Adres = dr[3].ToString(), TelefoonNr = int.Parse(dr[4].ToString()), School = dr[5].ToString() });
              }
              return View(students);
  
          }
      }
  }
  </code></pre>
  
  <p>And a View:</p>
  
  <pre><code>@model  IEnumerable&lt;LaatsteStudentWebAPI.Models.Student&gt;
  
  @{
      ViewBag.Title = "Index";
  }
  
  &lt;h2&gt;This is the Index&lt;/h2&gt;
  &lt;table&gt;
  
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;td&gt;StudentNummer&lt;/td&gt;
              &lt;td&gt;Naam&lt;/td&gt;
              &lt;td&gt;Woonplaats&lt;/td&gt;
              &lt;td&gt;Adres&lt;/td&gt;
              &lt;td&gt;Telefoonnummer&lt;/td&gt;
              &lt;td&gt;School&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
  
  @foreach (var item in LaatsteStudentWebAPI.Models.Student)
  {
      &lt;tr&gt;
          &lt;td&gt;@item.StudenNr&lt;/td&gt;
          &lt;td&gt;@item.Naam&lt;/td&gt;
          &lt;td&gt;@item.Woonplaats&lt;/td&gt;
          &lt;td&gt;@item.Adres&lt;/td&gt;
          &lt;td&gt;@item.TelefoonNr&lt;/td&gt;
          &lt;td&gt;@item.School&lt;/td&gt;
  
  
      &lt;/tr&gt;
  
  }
  &lt;/table&gt;
  </code></pre>
  
  <p>Now my problem is that when i run it everything looks alright, ( i know its messy code but just want it to work )
  but i get this problem/error.</p>
  
  <blockquote>
    <p>Description: An error occurred during the compilation of a resource
    required to service this request. Please review the following specific
    error details and modify your source code appropriately. </p>
    
    <p>Compiler Error Message: CS0119: 'LaatsteStudentWebAPI.Models.Student'
    is a 'type', which is not valid in the given context</p>
  </blockquote>
  
  <pre><code>Line 20: 
  Line 21: 
  Line 22: @foreach (var item in LaatsteStudentWebAPI.Models.Student)
  Line 23: {
  Line 24:     &lt;tr&gt;
  </code></pre>
  
  <p>what is going wrong it has to be a small problem i think and hopefully easy to fix i hope you guys cant help me.</p>