Пример #1
0
        /// <summary>
        /// 取分页数据,返回 JSON
        /// </summary>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public IActionResult List(int pageindex, int pagesize, string key, string month, string cabh)
        {
            List <Model.Blog> list = dal.GetListArray("*", "sort asc,id desc", pagesize, pageindex, GetCond(key, month, cabh));
            ArrayList         arr  = new ArrayList();

            foreach (var item in list)
            {
                arr.Add(new
                {
                    id         = item.id,
                    title      = item.title,
                    createDate = item.createdate.ToString("yyyy-MM-dd HH:mm"),
                    caName     = item.caname,
                    desc       = Tool.ReplaceHtmlTag(item.body, 60),
                });
            }
            return(Json(arr));
        }
Пример #2
0
        /// <summary>
        /// 取分页数据,返回 JSON
        /// </summary>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public IActionResult List(int pageindex, int pagesize, string key, string start, string end, string cabh)
        {
            List <Model.Blog> list = dal.GetListArray("*", "sort asc,id desc", pagesize, pageindex, GetCond(key, start, end, cabh));
            ArrayList         arr  = new ArrayList();

            foreach (var item in list)
            {
                arr.Add(new
                {
                    id         = item.id,
                    title      = item.title,
                    updatetime = item.updatetime.ToString("yyyy-MM-dd HH:mm"),
                    createDate = item.createdate.ToString("yyyy-MM-dd HH:mm"),
                    visitNum   = item.visitnum,
                    caName     = item.caname,
                    sort       = item.sort,
                });
            }
            return(Json(arr));
        }