示例#1
0
        public HttpResponseMessage GetElementsByTag(int?programId, string tagCode)
        {
            try
            {
                var COPList = TaskServices.GetElementsByCopId(programId, tagCode);

                var _result = COPList.Select(m => new
                {
                    CmsStandardID           = m.CmsStandardID,
                    TagCode                 = m.TagCode,
                    JcrElementText          = m.JcrElementText.Replace("<br/>", ""),
                    JcrElementTextShortened = m.JcrElementText.Length > 150 ? m.JcrElementText.Substring(0, 150) + "..." : m.JcrElementText,
                    ElementSortOrder        = m.ElementSortOrder
                });

                return(Request.CreateResponse(HttpStatusCode.OK, _result));
            }
            catch (Exception ex)
            {
                ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetElementsByTag");
                WebExceptionHelper.LogException(ex, null);
                return(Request.CreateResponse(HttpStatusCode.OK, string.Empty));
            }
        }