http-api/src/Application/Employees/EmployeeDto.cs

41 lines
1.0 KiB
C#

using cuqmbr.TravelGuide.Application.Common.Mappings;
using cuqmbr.TravelGuide.Domain.Entities;
namespace cuqmbr.TravelGuide.Application.Employees;
public sealed class EmployeeDto : IMapFrom<Employee>
{
public Guid Uuid { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Patronymic { get; set; }
public string Sex { get; set; }
public DateOnly BirthDate { get; set; }
public Guid CompanyUuid { get; set; }
public ICollection<EmployeeDocumentDto> Documents { get; set; }
public EmployeeAccountDto Account { get; set; }
public void Mapping(MappingProfile profile)
{
profile.CreateMap<Employee, EmployeeDto>()
.ForMember(
d => d.Uuid,
opt => opt.MapFrom(s => s.Guid))
.ForMember(
d => d.Sex,
opt => opt.MapFrom(s => s.Sex.Name))
.ForMember(
d => d.CompanyUuid,
opt => opt.MapFrom(s => s.Company.Guid));
}
}