Changed over the content/media type mappers to be auto-mapper based
This commit is contained in:
@@ -20,21 +20,6 @@ namespace Umbraco.Web.Models.Mapping
|
||||
UserMapper = userMapper;
|
||||
}
|
||||
|
||||
//protected ContentItemDto<TPersisted> ToContentItemDtoBase<TPersisted>(IContentBase content)
|
||||
// where TPersisted : IContentBase
|
||||
//{
|
||||
// return CreateContent<ContentItemDto<TPersisted>, ContentPropertyDto, TPersisted>(content, null, (propertyDto, originalProperty, propEditor) =>
|
||||
// {
|
||||
// propertyDto.IsRequired = originalProperty.PropertyType.Mandatory;
|
||||
// propertyDto.ValidationRegExp = originalProperty.PropertyType.ValidationRegExp;
|
||||
// propertyDto.Alias = originalProperty.Alias;
|
||||
// propertyDto.Description = originalProperty.PropertyType.Description;
|
||||
// propertyDto.Label = originalProperty.PropertyType.Name;
|
||||
// propertyDto.DataType = ApplicationContext.Services.DataTypeService.GetDataTypeDefinitionById(originalProperty.PropertyType.DataTypeDefinitionId);
|
||||
// propertyDto.PropertyEditor = PropertyEditorResolver.Current.GetById(originalProperty.PropertyType.DataTypeId);
|
||||
// });
|
||||
//}
|
||||
|
||||
protected ContentItemBasic<ContentPropertyBasic, TPersisted> ToContentItemSimpleBase<TPersisted>(IContentBase content)
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
internal class ContentTypeModelMapper
|
||||
{
|
||||
private readonly ApplicationContext _applicationContext;
|
||||
|
||||
public ContentTypeModelMapper(ApplicationContext applicationContext)
|
||||
{
|
||||
_applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public ContentTypeBasic ToContentTypeBasic(IContentType contentType)
|
||||
{
|
||||
return new ContentTypeBasic
|
||||
{
|
||||
Alias = contentType.Alias,
|
||||
Id = contentType.Id,
|
||||
Description = contentType.Description,
|
||||
Icon = contentType.Icon,
|
||||
Name = contentType.Name
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,20 @@
|
||||
using Umbraco.Core;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Mapping;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
internal class MediaTypeModelMapper
|
||||
{
|
||||
private readonly ApplicationContext _applicationContext;
|
||||
|
||||
public MediaTypeModelMapper(ApplicationContext applicationContext)
|
||||
/// <summary>
|
||||
/// Defines mappings for content/media (and i'm sure one day member) type mappings
|
||||
/// </summary>
|
||||
internal class ContentTypeModelMapper : MapperConfiguration
|
||||
{
|
||||
public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
|
||||
{
|
||||
_applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public ContentTypeBasic ToMediaTypeBasic(IMediaType contentType)
|
||||
{
|
||||
return new ContentTypeBasic
|
||||
{
|
||||
Alias = contentType.Alias,
|
||||
Id = contentType.Id,
|
||||
Description = contentType.Description,
|
||||
Icon = contentType.Icon,
|
||||
Name = contentType.Name
|
||||
};
|
||||
config.CreateMap<IMediaType, ContentTypeBasic>();
|
||||
config.CreateMap<IContentType, ContentTypeBasic>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user