Files
Umbraco-CMS/src/Umbraco.Web/Models/Mapping/SectionModelMapper.cs
2017-08-10 17:59:17 +10:00

21 lines
748 B
C#

using AutoMapper;
using Umbraco.Core;
using Umbraco.Core.Models.Mapping;
using Umbraco.Web.Models.ContentEditing;
using umbraco;
namespace Umbraco.Web.Models.Mapping
{
internal class SectionModelMapper : MapperConfiguration
{
public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
{
config.CreateMap<Core.Models.Section, Section>()
.ForMember(section => section.RoutePath, x => x.Ignore())
.ForMember(
dto => dto.Name,
expression => expression.MapFrom(section => ui.Text("sections", section.Alias)))
.ReverseMap(); //backwards too!
}
}
}