Ejemplo n.º 1
0
        // Umbraco.Code.MapAll -Properties -Errors -Edited -Updater -Alias -IsChildOfListView
        // Umbraco.Code.MapAll -Trashed -IsContainer -VariesByCulture
        private void Map(IMember source, MemberDisplay target, MapperContext context)
        {
            target.ContentApps      = _commonMapper.GetContentApps(source);
            target.ContentType      = _commonMapper.GetContentType(source, context);
            target.ContentTypeId    = source.ContentType.Id;
            target.ContentTypeAlias = source.ContentType.Alias;
            target.ContentTypeName  = source.ContentType.Name;
            target.CreateDate       = source.CreateDate;
            target.Icon             = source.ContentType.Icon;
            target.Id          = source.Id;
            target.Key         = source.Key;
            target.Name        = source.Name;
            target.Owner       = _commonMapper.GetOwner(source, context);
            target.ParentId    = source.ParentId;
            target.Path        = source.Path;
            target.SortOrder   = source.SortOrder;
            target.State       = null;
            target.Tabs        = _tabsAndPropertiesMapper.Map(source, context);
            target.TreeNodeUrl = _commonTreeNodeMapper.GetTreeNodeUrl <MemberTreeController>(source);
            target.Udi         = Udi.Create(Constants.UdiEntityType.Member, source.Key);
            target.UpdateDate  = source.UpdateDate;

            //Membership
            target.Username             = source.Username;
            target.Email                = source.Email;
            target.MembershipProperties = _tabsAndPropertiesMapper.MapMembershipProperties(source, context);
        }
Ejemplo n.º 2
0
        // Umbraco.Code.MapAll -AllowPreview -Errors -PersistedContent
        private void Map(IContent source, ContentItemDisplay target, MapperContext context)
        {
            // Both GetActions and DetermineIsChildOfListView use parent, so get it once here
            // Parent might already be in context, so check there before using content service
            IContent parent;

            if (context.Items.TryGetValue("Parent", out var parentObj) &&
                parentObj is IContent typedParent)
            {
                parent = typedParent;
            }
            else
            {
                parent = _contentService.GetParent(source);
            }

            target.AllowedActions   = GetActions(source, parent, context);
            target.AllowedTemplates = GetAllowedTemplates(source);
            target.ContentApps      = _commonMapper.GetContentApps(source);
            target.ContentTypeId    = source.ContentType.Id;
            target.ContentTypeKey   = source.ContentType.Key;
            target.ContentTypeAlias = source.ContentType.Alias;
            target.ContentTypeName  = _localizedTextService.UmbracoDictionaryTranslate(_cultureDictionary, source.ContentType.Name);
            target.DocumentType     = _commonMapper.GetContentType(source, context);
            target.Icon             = source.ContentType.Icon;
            target.Id                = source.Id;
            target.IsBlueprint       = source.Blueprint;
            target.IsChildOfListView = DetermineIsChildOfListView(source, parent, context);
            target.IsContainer       = source.ContentType.IsContainer;
            target.IsElement         = source.ContentType.IsElement;
            target.Key               = source.Key;
            target.Owner             = _commonMapper.GetOwner(source, context);
            target.ParentId          = source.ParentId;
            target.Path              = source.Path;
            target.SortOrder         = source.SortOrder;
            target.TemplateAlias     = GetDefaultTemplate(source);
            target.TemplateId        = source.TemplateId ?? default;
            target.Trashed           = source.Trashed;
            target.TreeNodeUrl       = _commonTreeNodeMapper.GetTreeNodeUrl <ContentTreeController>(source);
            target.Udi               = Udi.Create(source.Blueprint ? Constants.UdiEntityType.DocumentBlueprint : Constants.UdiEntityType.Document, source.Key);
            target.UpdateDate        = source.UpdateDate;
            target.Updater           = _commonMapper.GetCreator(source, context);
            target.Urls              = GetUrls(source);
            target.Variants          = _contentVariantMapper.Map(source, context);

            target.ContentDto            = new ContentPropertyCollectionDto();
            target.ContentDto.Properties = context.MapEnumerable <IProperty, ContentPropertyDto>(source.Properties);
        }