/// <inheritdoc />
        public IContent CreateContentFromTemplate(string name, Guid parentId, Guid templateId, CancellationToken cancellationToken)
        {
            var parent        = _contentService.GetById(parentId);
            var template      = _contentService.GetById(templateId);
            var clonedContent = _contentService.Copy(template, parent.Id, false);

            clonedContent.Name = name;
            PublishContentWithDescendants(clonedContent, cancellationToken);
            return(clonedContent);
        }
Exemple #2
0
        public IContent CopyTenant(IContent sourceTenant, int parentId, string tenantUId)
        {
            try
            {
                var newTenant = contentService.Copy(sourceTenant, parentId, false, -1);

                newTenant.SetValue("tenantUid", tenantUId);

                contentService.Save(newTenant);

                ConnectorContext.AuditService.Add(AuditType.Copy, -1, newTenant.Id, "Content Node", $"ContentNode for {tenantUId} has been created");

                return(newTenant);
            }
            catch (Exception ex)
            {
                logger.Error(typeof(NodeHelper), ex.Message);
                logger.Error(typeof(NodeHelper), ex.StackTrace);
                throw;
            }
        }
 public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1)
 {
     return(inner.Copy(content, parentId, relateToOriginal, userId));
 }