Beispiel #1
0
        //[Authorize("Permission")]
        public async Task <object> Get(int id)
        {
            var model = await blogArticleServices.getBlogDetails(id);

            return(Ok(new
            {
                success = true,
                data = model
            }));
        }
        /// <summary>
        /// 详情页
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Detail(int id)
        {
            //获取控制器名称
            ViewBag.controllername = RouteData.Values["controller"].ToString().ToLower();
            var model = BlogArticleServive.getBlogDetails(id);

            ViewBag.gblist = GuestbookServices.QueryOrderBy(c => c.blogId == id, c => c.createdate, false).ToPagedList(1, 5);

            //发布时间排序
            ViewBag.blogtimelist = BlogArticleServive.QueryOrderBy(c => true, c => c.bCreateTime, false);
            //评论排序
            ViewBag.blogtrafficlist = BlogArticleServive.QueryOrderBy(c => true, c => c.btraffic, false);
            //留言排序
            string sql = @"select a.*,b.btitle from (select blogId,count(1) as counts  from Guestbook group by blogId) as a
inner join BlogArticle as b
on
b.bID=a.blogId order by counts desc";

            ViewBag.blogguestbooklist = GuestbookServices.RunProc <TopgbViewModels>(sql);

            return(View(model));
        }
 public async Task <BlogViewModel> GetBlogDetails(int id)
 {
     return(await _blogArticleServices.getBlogDetails(id));
 }