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