Exemplo n.º 1
0
        /// <summary>
        /// get pageindex and size,return JSON
        /// </summary>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public IActionResult List(int pageindex, int pagesize, string key, string month, string caNum)
        {
            List <Model.Blog> list = dal.GetList("sort asc,id desc", pagesize, pageindex, GetCond(key, month, caNum));
            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.StringTruncat(Tool.GetNoHTMLString(item.Body), 60, "..."),
                });
            }
            return(Json(arr));
        }
Exemplo n.º 2
0
        public IActionResult List(int pageindex, int pagesize, string key, string start, string end, string caNum)
        {
            List <Blog> list = dal.GetList("sort asc, id desc", pagesize, pageindex, GetCond(key, start, end, caNum));
            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"),
                    visitNum   = item.VisitNum,
                    caName     = item.CaName,
                    sort       = item.Sort,
                });
            }
            return(Json(arr));
        }