示例#1
0
        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetArticleList(HttpContext context)
        {
            var dataList = bll.GetArticleList(context.Request["cateid"], context.Request["name"]);

            dataList = dataList.Where(p => p.IsHide.Equals(0) && p.IsDelete.Equals(0)).ToList();
            List <ArticleModel> list = new List <ArticleModel>();
            string host = string.Format("http://{0}", context.Request.Url.Authority);

            foreach (var source in dataList)
            {
                ArticleModel model = new ArticleModel();
                model.ArticleTitle      = source.ActivityName;
                model.ArticleContent    = source.Summary;
                model.ArticleThumbnails = bll.GetImgUrl(source.ThumbnailsPath);
                model.ArticleUrl        = string.Format("{0}/{1}/details.chtml", host, source.JuActivityIDHex);
                model.Pv   = source.PV;
                model.Time = source.CreateDate.ToString("yyyy-MM-dd");
                list.Add(model);
            }
            return(Common.JSONHelper.ObjectToJson(list));
        }