コード例 #1
0
        public JsonResult GetArticleData(string companyId)
        {
            JsonResult        json   = new JsonResult();
            List <WX_Article> models = WXArticleServices.QueryAll(companyId);

            if (models.Count > 0)
            {
                List <string> groupIds = models.Select(p => p.GroupID).Distinct().ToList();
                var           result   = from p in groupIds
                                         select new
                {
                    id   = p,
                    text = models.OrderBy(o => o.Sort).First(o => o.GroupID == p).Title
                };
                json.Data = result;
            }
            return(json);
        }
コード例 #2
0
        public JsonResult GetWXArticleData(string companyId)
        {
            JsonResult json = new JsonResult();

            try
            {
                List <WX_Article> models   = WXArticleServices.QueryAll(companyId);
                List <string>     groupIds = models.Select(p => p.GroupID).Distinct().ToList();
                var result = from p in groupIds
                             select new
                {
                    GroupId = p,
                    Count   = models.Count(o => o.GroupID == p),
                    Title   = models.OrderBy(o => o.Sort).First(o => o.GroupID == p).Title
                };
                json.Data = result;
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "查询图文信息失败");
            }

            return(json);
        }