Add AutoMapper profile for EmailTemplate mappings
Introduced MappingProfile in EmailTemplates namespace. Maps EmailTemplate to EmailTemplateDto and UpdateEmailTemplateCommand to EmailTemplate, ignoring Id and setting ChangedWhen to current time.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Application.Common.Dto;
|
||||
using EnvelopeGenerator.Application.EmailTemplates.Commands;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EmailTemplates;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class MappingProfile : Profile
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public MappingProfile()
|
||||
{
|
||||
CreateMap<EmailTemplate, EmailTemplateDto>();
|
||||
|
||||
CreateMap<UpdateEmailTemplateCommand, EmailTemplate>()
|
||||
.ForMember(dest => dest.Id, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(_ => DateTime.Now));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user