Files
Umbraco-CMS/src/Umbraco.Web/Models/Mapping/AuditMapDefinition.cs
2019-04-03 10:39:49 +02:00

27 lines
868 B
C#

using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
{
internal class AuditMapDefinition : IMapDefinition
{
public void DefineMaps(UmbracoMapper mapper)
{
mapper.Define<IAuditItem, AuditLog>((source, context) => new AuditLog(), Map);
}
// Umbraco.Code.MapAll -UserAvatars -UserName
private void Map(IAuditItem source, AuditLog target, MapperContext context)
{
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;
}
}
}