So I'm creating a table to output the values of my database's data. During the process, I was able to output, but only the first record. Then I searched for it and noticed that I had to do a list to store all the data and now I'm stuck. I'm pretty sure it's simple, but I'm only starting
I wanted to do this:
List<EmployeeViewModel> EmployeeVM = new List<EmployeeViewModel>
{
MovieID = movie.MovieID,
MovieName = movie.MovieName,
MovieDescription = movie.MovieDescription,
MoviePrice = movie.MoviePrice,
MovieCategory = movie.MovieCategory,
MovieYear = movie.MovieYear
};
return View(EmployeeVM);
so that i can output like this:
<table class="table table-bordered table-responsive table-hover">
<tr>
<th><b>Movie Name </b></th>
<th><b>Movie Category </b></th>
<th><b>Movie Year </b></th>
<th><b>Movie Price</b></th>
</tr>
@foreach (EmployeeViewModel item in EmployeeVM)
{
<tr>
<td>@Model.MovieName</td>
<td>@Model.MovieCategory</td>
<td>@Model.MovieYear
<td>@Model.MoviePrice</td>
</tr>
}
</table>
"List" does not contain a definition for "MovieName"
"The type or namespace name 'EmployeeViewModel' could not be found (are you missing a using directive or an assembly reference?)"