电影名称
</th>
<th>
发行日期
</th>
<th>
种类
</th>
<th>
票价
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.ActionLink("编辑", "Edit", new { id=item.ID }) |
@Html.ActionLink("查看明细", "Details", new
{ id=item.ID }) |
@Html.ActionLink("删除", "Delete", new { id=item.ID })
</td>
<td>
@item.Title
</td>
<td>
@String.Format("{0:d}", item.ReleaseDate)
</td>
<td>
@item.Genre
</td>
<td>
@String.Format("{0:c2}", item.Price)
</td>
</tr>
}
</table>
5.2 强类型模型与@model 关键字
在本教程的前文中,我们介绍了一个控制器可以使用 ViewBag 对象来将数据或对象
传递到视图模板中。ViewBag 是一个动态对象,它提供了一种便利的,后期绑定的方法
来将信息从控制器传递到视图中。
ASP.NET MVC 也提供了一种利用强类型的方法来将数据或对象传递到视图模板中。
这种强类型的方法为你的编码过程提供了很丰富的编辑时的智能输入提示信息与非常好