Merge branch '3436-relations-editor' of https://github.com/jamescoxhead/Umbraco-CMS into jamescoxhead-3436-relations-editor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using AutoMapper;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Relation = Umbraco.Web.Models.ContentEditing.Relation;
|
||||
using RelationType = Umbraco.Web.Models.ContentEditing.RelationType;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
@@ -9,11 +9,35 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
public RelationMapperProfile()
|
||||
{
|
||||
//FROM IRelationType TO RelationType
|
||||
CreateMap<IRelationType, RelationType>();
|
||||
// FROM IRelationType to RelationTypeDisplay
|
||||
CreateMap<IRelationType, RelationTypeDisplay>()
|
||||
.ForMember(x => x.Icon, expression => expression.Ignore())
|
||||
.ForMember(x => x.Trashed, expression => expression.Ignore())
|
||||
.ForMember(x => x.Alias, expression => expression.Ignore())
|
||||
.ForMember(x => x.Path, expression => expression.Ignore())
|
||||
.ForMember(x => x.AdditionalData, expression => expression.Ignore())
|
||||
.ForMember(x => x.ChildObjectTypeName, expression => expression.Ignore())
|
||||
.ForMember(x => x.ParentObjectTypeName, expression => expression.Ignore())
|
||||
.ForMember(x => x.Relations, expression => expression.Ignore())
|
||||
.ForMember(
|
||||
x => x.Udi,
|
||||
expression => expression.MapFrom(
|
||||
content => Udi.Create(Constants.UdiEntityType.RelationType, content.Key)))
|
||||
.AfterMap((src, dest) =>
|
||||
{
|
||||
// Build up the path
|
||||
dest.Path = "-1," + src.Id;
|
||||
|
||||
//FROM IRelation TO Relation
|
||||
CreateMap<IRelation, Relation>();
|
||||
// Set the "friendly" names for the parent and child object types
|
||||
dest.ParentObjectTypeName = ObjectTypes.GetUmbracoObjectType(src.ParentObjectType).GetFriendlyName();
|
||||
dest.ChildObjectTypeName = ObjectTypes.GetUmbracoObjectType(src.ChildObjectType).GetFriendlyName();
|
||||
});
|
||||
|
||||
// FROM IRelation to RelationDisplay
|
||||
CreateMap<IRelation, RelationDisplay>();
|
||||
|
||||
// FROM RelationTypeSave to IRelationType
|
||||
CreateMap<RelationTypeSave, IRelationType>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user