public int SaveLink(int siteId, SiteLinkDto dto) { var site = _repo.GetSiteById(siteId); ISiteLink link = null; if (dto.Id <= 0) { link = _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()); }
public SiteLinkDto GetLinkById(int siteId, int linkId) { var site = _repo.GetSiteById(siteId); var link = site.GetLinkManager().GetLinkById(linkId); if (link == null) { return(default(SiteLinkDto)); } return(SiteLinkDto.ConvertFrom(link)); }
public IEnumerable <SiteLinkDto> GetLinksByType(int siteId, SiteLinkType type, bool ignoreDisabled) { var site = _repo.GetSiteById(siteId); var links = site.GetLinkManager().GetLinks(type); foreach (var link in links) { if (!ignoreDisabled && !link.Visible) { continue; } yield return(SiteLinkDto.ConvertFrom(link)); } }