public Index ( ) : System.Web.Mvc.ActionResult | ||
return | System.Web.Mvc.ActionResult |
public ActionResult Index()
{
db = new biosealEntities();
//group by 分组遍历所有新闻,每个类别取前5条记录
var News = from t in db.News
group t by t.CategoryId into g
select g.OrderByDescending(i => i.DateTime).Take(5);
return View(News);
}