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); }