Esempio n. 1
0
        public int SaveRelatedLink(int siteId, RelatedLinkDto linkDto)
        {
            IBaseContent content = this.GetContent(siteId, linkDto.ContentType, linkDto.ContentId);

            if (linkDto.Id > 0)
            {
                IContentLink link = content.LinkManager.GetLinkById(linkDto.Id);
                link.RelatedIndent    = linkDto.RelatedIndent;
                link.RelatedContentId = linkDto.RelatedContentId;
                link.Enabled          = linkDto.Enabled;
                link.RelatedSiteId    = linkDto.RelatedSiteId;
            }
            else
            {
                content.LinkManager.Add(linkDto.Id, linkDto.RelatedSiteId, linkDto.RelatedIndent, linkDto.RelatedContentId, linkDto.Enabled);
            }

            content.LinkManager.SaveRelatedLinks();
            return(linkDto.Id);
        }
Esempio n. 2
0
        public string Save_related_link_POST()
        {
            try
            {
                var dto = new RelatedLinkDto
                {
                    Id               = int.Parse(Request.Form("Id")),
                    ContentId        = int.Parse(Request.Form("ContentId")),
                    ContentType      = Request.Form("ContentType"),
                    RelatedIndent    = int.Parse(Request.Form("RelatedIndent")),
                    RelatedSiteId    = int.Parse(Request.Form("RelatedSiteId")),
                    RelatedContentId = int.Parse(Request.Form("RelatedContentId")),
                    Enabled          = Request.Form("Enabled") == "1",
                };

                ServiceCall.Instance.ContentService.SaveRelatedLink(SiteId, dto);

                return(ReturnSuccess(dto.Id == 0 ? "添加成功" : "保存成功"));
            }
            catch (Exception exc)
            {
                return(ReturnError(exc.Message));
            }
        }