24 lines
737 B
C#
24 lines
737 B
C#
|
using AutoMapper;
|
||
|
using Galaeth.Core.Dtos;
|
||
|
using Galaeth.Core.Entities;
|
||
|
using Galaeth.Services.Dtos;
|
||
|
|
||
|
namespace Galaeth.Services.Profiles;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Profile for AutoMapper.
|
||
|
/// </summary>
|
||
|
public class AutomapperProfile : Profile
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Initializes a new instance of the <see cref="AutomapperProfile"/> class.
|
||
|
/// </summary>
|
||
|
public AutomapperProfile()
|
||
|
{
|
||
|
CreateMap<User, UserDto>()
|
||
|
.ForMember(dest => dest.RegistrationDate, opt => opt.MapFrom(src => src.CreatedAt))
|
||
|
.ForMember(dest => dest.RegistrationDateTicks, opt => opt.MapFrom(src => src.CreatedAt.Ticks))
|
||
|
.ForMember(dest => dest.RoleTitle, opt => opt.MapFrom(src => src.Role.ToString()));
|
||
|
}
|
||
|
}
|