Example #1
0
        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));
        }
Example #2
0
 //
 // GET: /Blog/
 public ActionResult Add(int?id)
 {
     ViewData["blogSort"] = BlogModel.GetBlogSorts();
     if (LoginHelper.IsEditMode && id.HasValue)
     {
         Blog blog = BlogModel.GetBlog(id.Value);
         return(View(blog));
     }
     return(View());
 }