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

29 lines
813 B
C#
Raw Normal View History

using AutoMapper;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
2017-09-12 16:22:16 +02:00
using UserProfile = Umbraco.Web.Models.ContentEditing.UserProfile;
namespace Umbraco.Web.Models.Mapping
{
/// <summary>
/// Maps the Owner for IContentBase
/// </summary>
/// <typeparam name="TPersisted"></typeparam>
2017-07-19 13:42:47 +02:00
internal class OwnerResolver<TPersisted>
where TPersisted : IContentBase
{
private readonly IUserService _userService;
public OwnerResolver(IUserService userService)
{
_userService = userService;
}
2017-09-12 16:22:16 +02:00
public UserProfile Resolve(TPersisted source)
{
2017-09-12 16:22:16 +02:00
return Mapper.Map<IProfile, UserProfile>(source.GetCreatorProfile(_userService));
}
}
2017-07-20 11:21:28 +02:00
}