Exemple #1
0
        public int SaveLink(int siteId, SiteLinkDto dto)
        {
            ISite     site = this.repo.GetSiteById(siteId);
            ISiteLink link = null;

            if (dto.Id <= 0)
            {
                link = this.repo.CreateLink(site, 0, dto.Text);
            }
            else
            {
                link = site.GetLinkManager().GetLinkById(dto.Id);
            }

            link.Bind       = dto.Bind;
            link.ImgUrl     = dto.ImgUrl;
            link.SortNumber = dto.SortNumber;
            link.Pid        = dto.Pid;
            link.Target     = dto.Target;
            link.Text       = dto.Text;
            link.Type       = dto.Type;
            link.Uri        = dto.Uri;
            link.Visible    = dto.Visible;

            return(link.Save());
        }
Exemple #2
0
        public SiteLinkDto GetLinkById(int siteId, int linkId)
        {
            ISite     site = this.repo.GetSiteById(siteId);
            ISiteLink link = site.GetLinkManager().GetLinkById(linkId);

            if (link == null)
            {
                return(default(SiteLinkDto));
            }

            return(SiteLinkDto.ConvertFrom(link));
        }
Exemple #3
0
        public IEnumerable <SiteLinkDto> GetLinksByType(int siteId, SiteLinkType type, bool ignoreDisabled)
        {
            ISite site = this.repo.GetSiteById(siteId);
            IEnumerable <ISiteLink> links = site.GetLinkManager().GetLinks(type);

            foreach (ISiteLink link in links)
            {
                if (!ignoreDisabled && !link.Visible)
                {
                    continue;
                }

                yield return(SiteLinkDto.ConvertFrom(link));
            }
        }
Exemple #4
0
        public void DeleteLink(int siteId, int linkId)
        {
            ISite site = this.repo.GetSiteById(siteId);

            site.GetLinkManager().DeleteLink(linkId);
        }