1.action写法:
#region 列表首页
public ActionResult Index()
{
YunWeiEntities db = new YunWeiEntities();
return View(db.vpnuserinfotest1.ToList());
}
#endregion
2.试图写法
@model IEnumerable<haha20171114.EFmodel.vpnuserinfotest1>
<h2>Index</h2>
<h3>xxf Hello World!</h3>
<p>
@Html.ActionLink("创建", "Create")
</p>
<table>
<tr>
<th>自动ID</th>
<th>姓名</th>
<th>登录ID</th>
<th>操作</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@item.ID</td>
<td>@item.Name</td>
<td>@item.UserID</td>
<td>
@Html.ActionLink("编辑", "Edit", new { id = item.ID }) |
@Html.ActionLink("详情", "Details", new { id = item.ID }) |
@Html.ActionLink("删除", "Delete", new { id = item.ID })
</td>
</tr>
}
</table>