コントローラがあり、インデックス ページがある場合:
@model IEnumerable<MvcMovie.Models.Movie>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<table>
<tr>
<th>
Title
</th>
....
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
....
</tr>
}
</table>
を使用する利点は@model IEnumerable<Movie>
何ですか? ViewBag.Movies
Controller で定義してそれを index ページで使用できないのはなぜですか?