title: ASP.NET MVC: Pass list of objects from Controller to View
body: <p>So this piece of code is my <code>Controller</code> class. I am sending a list of books to the <code>View</code></p>
  
  <pre><code>public class BooksController : Controller
  {
       public ActionResult Index(int page = 0)
       {
            List&lt;Book&gt; data = BookRepository.GetInstance().getAllBooks();
            return this.View(data);
       }
  }
  </code></pre>
  
  <p>So I wrote this on the top refering the model class </p>
  
  <p><code>@model BookStore.Models.Book</code></p>
  
  <p>When I try to iterate like the below code, it says, it does not contain public instance for <code>GetEnumerator</code>, but I returned a list of objects, how do I access each object in the list in the for loop?</p>
  
  <pre><code>&lt;ul&gt;
     @foreach(var book in Model)
     {
  
     }
  &lt;/ul&gt;
  </code></pre>