Files
Umbraco-CMS/src/Umbraco.Web/Models/Mapping/SectionMapperProfile.cs

19 lines
651 B
C#
Raw Normal View History

2017-07-19 13:42:47 +02:00
using System.Collections.Generic;
using AutoMapper;
using Umbraco.Core.Services;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
{
2017-09-20 20:06:46 +02:00
internal class SectionMapperProfile : Profile
2017-07-19 13:42:47 +02:00
{
2017-09-20 20:06:46 +02:00
public SectionMapperProfile(ILocalizedTextService textService)
2017-07-19 13:42:47 +02:00
{
CreateMap<Core.Models.Section, Section>()
2017-09-19 15:51:47 +02:00
.ForMember(dest => dest.RoutePath, opt => opt.Ignore())
2017-09-20 20:06:46 +02:00
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => textService.Localize("sections/" + src.Alias, (IDictionary<string, string>)null)))
2017-07-19 13:42:47 +02:00
.ReverseMap(); //backwards too!
}
}
2017-07-20 11:21:28 +02:00
}