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

22 lines
828 B
C#
Raw Normal View History

2016-03-15 16:39:17 +01:00
using System.Collections.Generic;
using AutoMapper;
using Umbraco.Core;
2016-03-15 16:39:17 +01:00
using Umbraco.Core.Services;
using Umbraco.Core.Models.Mapping;
using Umbraco.Web.Models.ContentEditing;
2013-10-09 15:04:30 +02:00
using umbraco;
namespace Umbraco.Web.Models.Mapping
{
internal class SectionModelMapper : ModelMapperConfiguration
{
public override void ConfigureMappings(IMapperConfiguration config, ApplicationContext applicationContext)
{
config.CreateMap<Core.Models.Section, Section>()
2013-10-09 15:04:30 +02:00
.ForMember(
dto => dto.Name,
2016-03-15 16:39:17 +01:00
expression => expression.MapFrom(section => applicationContext.Services.TextService.Localize("sections/" + section.Alias, (IDictionary<string, string>)null)))
.ReverseMap(); //backwards too!
}
}
}