public ActionResult Post(int id) { Blog blog = BlogModel.GetBlog(id); //更新点击次数 BlogModel.UpdateBlogVisit(blog); //上一篇 var bortherPost = BlogModel.GetBortherPost(id); ViewData["bortherPost"] = bortherPost; //标签 ViewData["blogSort"] = BlogModel.GetBlogSorts(id); //评论 ViewData["blogComments"] = BlogModel.GetComments(id); foreach (KeyValuePair <Int64, string> post in bortherPost) { if (post.Key > id) { ViewData["nextPost"] = post; } if (post.Key < id) { ViewData["lastPost"] = post; } } //下一篇 return(View(blog)); }