[ASP.NET_MVC]強型別顯示VIEW

  • 2982
  • 0

摘要:[ASP.NET_MVC]強型別顯示VIEW

Controller:

public ActionResult Index()
        {            
            var model = from p in db.tableName
                        where 1 != 1
                        select p;
            return View(model);            
        }

cshtml:

@model IEnumerable
@foreach (var item in Model)
{
     @item.empid
}