Exemple #1
0
        private RelatedLinkDto ConvertToLinkDto(int siteId, IContentLink link)
        {
            var site    = _siteRep.GetSiteById(link.RelatedSiteId);
            var content = GetContent(site.GetAggregaterootId(), ContentTypeIndent.Archive.ToString().ToLower(),
                                     link.RelatedContentId);
            string thumbnail = null;
            var    archive   = content as IArchive;

            if (archive != null)
            {
                thumbnail = archive.Get().Thumbnail;
            }

            return(new RelatedLinkDto
            {
                Id = link.Id,
                Enabled = link.Enabled,
                ContentId = link.ContentId,
                ContentType = link.ContentType,
                RelatedSiteId = link.RelatedSiteId,
                RelatedSiteName = site.Get().Name,
                RelatedContentId = link.RelatedContentId,
                RelatedIndent = link.RelatedIndent,
                Title = archive.Get().Title,
                Url = site.FullDomain + archive.Get().Path,
                Thumbnail = thumbnail,
                IndentName = ContentUtil.GetRelatedIndentName(link.RelatedIndent).Name,
            });
        }
Exemple #2
0
        public SiteDto[] GetUserRelationSites(int userId)
        {
            var data  = _userRepository.GetUserRoles(userId);
            var len   = data.Keys.Count;
            var sites = new SiteDto[len];

            if (len > 0)
            {
                var i = 0;
                foreach (var key in data.Keys)
                {
                    sites[i++] = SiteDto.ConvertFromSite(_siteRepository.GetSiteById(data[key].AppId));
                }
            }

            return(sites);
        }
Exemple #3
0
        public int SaveSite(SiteDto siteDto)
        {
            ISite site;

            if (siteDto.SiteId != 0)
            {
                site = repo.GetSiteById(siteDto.SiteId);
                if (site == null)
                {
                    throw new ArgumentException("No such site");
                }
            }
            else
            {
                site = repo.CreateSite(new Models.CmsSiteEntity());
            }

            SiteDto.CopyTo(siteDto, site);
            return(site.Save());
        }