2016-03-15 16:39:17 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using AutoMapper;
|
2013-08-12 15:06:12 +02:00
|
|
|
|
using Umbraco.Core;
|
2016-03-15 16:39:17 +01:00
|
|
|
|
using Umbraco.Core.Services;
|
2013-08-12 15:06:12 +02:00
|
|
|
|
using Umbraco.Core.Models.Mapping;
|
|
|
|
|
|
using Umbraco.Web.Models.ContentEditing;
|
2013-10-09 15:04:30 +02:00
|
|
|
|
using umbraco;
|
2013-08-12 15:06:12 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Models.Mapping
|
|
|
|
|
|
{
|
2016-03-22 16:29:04 +01:00
|
|
|
|
internal class SectionModelMapper : ModelMapperConfiguration
|
2013-08-12 15:06:12 +02:00
|
|
|
|
{
|
2016-03-22 16:29:04 +01:00
|
|
|
|
public override void ConfigureMappings(IMapperConfiguration config, ApplicationContext applicationContext)
|
2013-08-12 15:06:12 +02:00
|
|
|
|
{
|
2013-11-28 13:20:52 +01:00
|
|
|
|
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)))
|
2013-08-12 15:06:12 +02:00
|
|
|
|
.ReverseMap(); //backwards too!
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-07-01 14:23:56 +10:00
|
|
|
|
}
|