Esempio n. 1
0
        /// <summary>
        /// 文章列表Json
        /// </summary>
        /// <param name="title">标题</param>
        /// <param name="input">录入者</param>
        /// <param name="category">栏目</param>
        /// <param name="fromDate">日期起</param>
        /// <param name="toDate">日期止</param>
        /// <param name="pageindex">页码</param>
        /// <param name="pageSize">每页记录数</param>
        /// <returns></returns>
        public ActionResult JsonList(string title, string input, Nullable <int> category, Nullable <DateTime> fromDate, Nullable <DateTime> toDate, int pageindex = 1, int pageSize = 20)
        {
            if (category == null)
            {
                category = 0;
            }
            int _total;
            var _rows = commentModelService.FindPageList(out _total, pageindex, pageSize, "Article", title, (int)category, input, fromDate, toDate, 0).Select(
                cm => new MyNinesky.Models.CommonModelViewModel()
            {
                CategoryID    = cm.CategoryID,
                CategoryName  = cm.Category.Name,
                DefaultPicUrl = cm.DefaultPicUrl,
                Hits          = cm.Hits,
                Inputer       = cm.Inputer,
                Model         = cm.Model,
                ModelID       = cm.ModelID,
                ReleaseDate   = cm.ReleaseDate,
                Status        = cm.Status,
                Title         = cm.Title
            }
                );

            return(Json(new { total = _total, rows = _rows.ToList() }));
        }
Esempio n. 2
0
        /// <summary>
        /// 我的咨询Json列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public JsonResult MyJsonList(int pageIndex = 1, int pageSize = 20)
        {
            int _total;
            var _list = commentModelService.FindPageList(out _total, pageIndex, pageSize, "Consultation",
                                                         string.Empty, 0, User.Identity.Name, null, null, 0).ToList().Select(
                cm => new MyNinesky.Models.CommonModelViewModel()
            {
                CategoryID    = cm.CategoryID,
                CategoryName  = cm.Category.Name,
                DefaultPicUrl = cm.DefaultPicUrl,
                Hits          = cm.Hits,
                Inputer       = cm.Inputer,
                Model         = cm.Model,
                ModelID       = cm.ModelID,
                ReleaseDate   = cm.ReleaseDate,
                Status        = cm.Status,
                Title         = cm.Title
            });

            return(Json(new { total = _total, rows = _list.ToList() }));
        }