Resvolution - Components, Runtime & Booting

This commit is contained in:
Stephan
2016-09-01 19:06:08 +02:00
parent 18f3a7fbab
commit 0597eea72b
405 changed files with 5114 additions and 6261 deletions

View File

@@ -1,21 +1,26 @@
using System.Collections.Generic;
using AutoMapper;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Core.Models.Mapping;
using Umbraco.Web.Models.ContentEditing;
using umbraco;
namespace Umbraco.Web.Models.Mapping
{
internal class SectionModelMapper : ModelMapperConfiguration
{
public override void ConfigureMappings(IMapperConfiguration config, ApplicationContext applicationContext)
private readonly ILocalizedTextService _textService;
public SectionModelMapper(ILocalizedTextService textService)
{
_textService = textService;
}
public override void ConfigureMappings(IMapperConfiguration config)
{
config.CreateMap<Core.Models.Section, Section>()
.ForMember(
dto => dto.Name,
expression => expression.MapFrom(section => applicationContext.Services.TextService.Localize("sections/" + section.Alias, (IDictionary<string, string>)null)))
expression => expression.MapFrom(section => _textService.Localize("sections/" + section.Alias, (IDictionary<string, string>)null)))
.ReverseMap(); //backwards too!
}
}