Files
Umbraco-CMS/src/Umbraco.Web/Models/Mapping/SectionMapperProfile.cs
2017-09-20 20:06:46 +02:00

19 lines
651 B
C#

using System.Collections.Generic;
using AutoMapper;
using Umbraco.Core.Services;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
{
internal class SectionMapperProfile : Profile
{
public SectionMapperProfile(ILocalizedTextService textService)
{
CreateMap<Core.Models.Section, Section>()
.ForMember(dest => dest.RoutePath, opt => opt.Ignore())
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => textService.Localize("sections/" + src.Alias, (IDictionary<string, string>)null)))
.ReverseMap(); //backwards too!
}
}
}