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

27 lines
868 B
C#
Raw Normal View History

2019-03-20 19:09:23 +01:00
using Umbraco.Core.Mapping;
2018-03-27 10:04:07 +02:00
using Umbraco.Core.Models;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
{
2019-04-03 10:39:49 +02:00
internal class AuditMapDefinition : IMapDefinition
2018-03-27 10:04:07 +02:00
{
2019-04-03 10:39:49 +02:00
public void DefineMaps(UmbracoMapper mapper)
2018-03-27 10:04:07 +02:00
{
mapper.Define<IAuditItem, AuditLog>((source, context) => new AuditLog(), Map);
2019-03-20 19:09:23 +01:00
}
// Umbraco.Code.MapAll -UserAvatars -UserName
private void Map(IAuditItem source, AuditLog target, MapperContext context)
2019-03-20 19:09:23 +01:00
{
target.UserId = source.UserId;
target.NodeId = source.Id;
target.Timestamp = source.CreateDate;
target.LogType = source.AuditType.ToString();
target.EntityType = source.EntityType;
target.Comment = source.Comment;
target.Parameters = source.Parameters;
2018-03-27 10:04:07 +02:00
}
}
}