// GET: News public ActionResult Index() { //热闻推荐 var news = (from p in db.News select p).ToList().OrderByDescending(a => a.News_Comment.Count()).ToList().Take(6); var index = new SEEWeb.ViewModel.NewsViewModel { NewsTop = news, }; return(View(index)); }
public ActionResult Details(int id) { News news = db.News.Find(id); var news1 = from m in db.News.OrderByDescending(p => p.News_Time) select m; var news_comment = from m in db.News_Comment.Where(p => p.News_ID == id).OrderByDescending(p => p.NC_Time) select m; var index = new SEEWeb.ViewModel.NewsViewModel() { News1 = news, News2 = news1, News_Comment = news_comment, }; return(View(index)); }