Resvolution - Components, Runtime & Booting
This commit is contained in:
@@ -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!
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user