prueba tecnica
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using AutoMapper;
|
||||
using Npgsql;
|
||||
using ProximaContracts.Domain.Contracts.DTOs.Response;
|
||||
using ProximaContracts.Domain.Contracts.Entities;
|
||||
|
||||
namespace ProximaContracts.Domain.Contracts.Mappings
|
||||
{
|
||||
public class ContractProfile : Profile
|
||||
{
|
||||
public ContractProfile()
|
||||
{
|
||||
#region Contract By ID
|
||||
CreateMap<NpgsqlDataReader, ContractByIdEntity>()
|
||||
.ForMember(d => d.Id, o => o.MapFrom(s => s.GetInt32(s.GetOrdinal("Id"))))
|
||||
.ForMember(d => d.ContractorIdNumber, o => o.MapFrom(s => s.GetString(s.GetOrdinal("ContractorIdNumber"))))
|
||||
.ForMember(d => d.ContractorName, o => o.MapFrom(s => s.GetString(s.GetOrdinal("ContractorName"))))
|
||||
.ForMember(d => d.ContractorSurname, o => o.MapFrom(s => s.GetString(s.GetOrdinal("ContractorSurname"))))
|
||||
.ForMember(d => d.ContractInitDate, o => o.MapFrom(s => s.GetDateTime(s.GetOrdinal("ContractInitDate"))))
|
||||
.ForMember(d => d.RateId, o => o.MapFrom(s => s.GetInt32(s.GetOrdinal("RateId"))))
|
||||
.ForMember(d => d.RateName, o => o.MapFrom(s => s.GetString(s.GetOrdinal("RateName"))))
|
||||
.ForMember(d => d.RatePrice, o => o.MapFrom(s => s.GetFieldValue<decimal>(s.GetOrdinal("RatePrice"))))
|
||||
;
|
||||
|
||||
CreateMap<ContractByIdEntity, ContractByIdResponseDto>();
|
||||
#endregion ContractByID
|
||||
|
||||
#region Contracts All
|
||||
CreateMap<NpgsqlDataReader, GetContractsEntity>()
|
||||
.ForMember(d => d.Id, o => o.MapFrom(s => s.GetInt32(s.GetOrdinal("Id"))))
|
||||
.ForMember(d => d.ContractorName, o => o.MapFrom(s => s.GetString(s.GetOrdinal("ContractorName"))))
|
||||
.ForMember(d => d.ContractorSurname, o => o.MapFrom(s => s.GetString(s.GetOrdinal("ContractorSurname"))))
|
||||
.ForMember(d => d.ContractInitDate, o => o.MapFrom(s => s.GetDateTime(s.GetOrdinal("ContractInitDate"))))
|
||||
.ForMember(d => d.RateName, o => o.MapFrom(s => s.GetString(s.GetOrdinal("RateName"))))
|
||||
;
|
||||
|
||||
CreateMap<GetContractsEntity, GetContractsResponseDto>();
|
||||
#endregion Contracts All
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user