Files
Vidly2/Vidly/Views/Movies/Index.cshtml

33 lines
837 B
Plaintext

@model Vidly.ViewModels.MoviesViewModel
@{
ViewBag.Title = "Movies";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Movies</h2>
@Html.ActionLink("New Movie", "New", "Movies", null, new { @class = "btn btn-primary" })
@if (Model.Movies.Count == 0)
{
<text>No one has rented this movie before.</text>
}
else
{
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Movie</th>
<th>Genre</th>
</tr>
</thead>
<tbody>
@foreach (var movie in Model.Movies)
{
<tr>
<td>@Html.ActionLink(@movie.Name, "Edit", "Movies", new { id = movie.Id }, null) </td>
<td>@movie.MovieGenre.Name</td>
</tr>
}
</tbody>
</table>
}