Пример #1
0
 public dynamic PostGetPages(MultiSimpleParameter filter)
 {
     try
     {
         PageStatus status = !String.IsNullOrEmpty(filter.Param2) ? (PageStatus)Enum.Parse(typeof(PageStatus), filter.Param2) : PageStatus.Any;
         var items = _worker.CmsContentRepository.SearchPages(filter.Param1, status);
         if (!String.IsNullOrEmpty(filter.Param3))
             items = items.Where(i => i.TopicId == Int32.Parse(filter.Param3)).ToList();
         var items2 = items.Select(z =>
                 new
                 {
                     PageName = z.PageName,
                     PageId = z.PageID,
                     Created = z.Created.ToString(CMS_i18n.Formats.DateFormat),
                     LastModified = z.LastModified.ToString(CMS_i18n.Formats.DateFormat),
                     CreatedBy = z.WrittenBy,
                     LastModifiedBy = z.LastChangedBy,
                     Status = z.Status.ToString(),
                     StartPublish = z.StartPublish,//Properties.Where(p => p.PropertyName == "Start publish").FirstOrDefault().PropertyValue,
                     EndPublish = z.EndPublish, //Properties.Where(p => p.PropertyName == "End Publish").FirstOrDefault().PropertyValue,
                     PageType = z.PageType,
                     EditUrl = "/" + ((ZCMSApplication)HttpContext.Current.ApplicationInstance).MainAdminUrl + "/PageEditor/" + z.PageID,
                     ViewUrl = "/" + ((ZCMSApplication)HttpContext.Current.ApplicationInstance).MainContentUrl + "/" + z.SlugValue,
                     TopicId = z.TopicId
                 });
         return items2;
     }
     catch
     {
         return null;
     }
 }
Пример #2
0
 public bool PostPageTopic(MultiSimpleParameter param)
 {
     var page = _worker.CmsContentRepository.GetCmsPage(param.Param1);
     if (page != null)
     {
         if (page.Instance.TopicId != Int32.Parse(param.Param2))
         {
             page.Instance.TopicId = Int32.Parse(param.Param2);
             return true;
         }
         else
             return false;
     }
     else
     {
         return false;
     }
 }
Пример #3
0
 public string RemoveAttachmentFromPage(MultiSimpleParameter param)
 {
     try
     {
         return _worker.FileRepository.DetachFromPage(param.Param1.Split('=')[1], param.Param2);
     }
     catch
     {
         return "failed to detach...";
     }
 }