end of tp2

This commit is contained in:
2026-03-17 11:12:34 +01:00
parent d202d1541d
commit 90fcaca356
7 changed files with 76 additions and 40 deletions

View File

@@ -13,18 +13,26 @@ public class DtoToEntityMappings : Profile
public DtoToEntityMappings()
{
CreateMap<CreateBookDto, Book>();
CreateMap<UpdateBookDto, Book>();
CreateMap<UpdateBookDto, Book>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreateAuthorDto, Author>();
CreateMap<UpdateAuthorDto, Author>();
CreateMap<UpdateAuthorDto, Author>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreateMemberDto, Member>();
CreateMap<UpdateMemberDto, Member>();
CreateMap<UpdateMemberDto, Member>()
.ForMember(dest => dest.Id, opt => opt.Ignore())
.ForMember(
dest => dest.Email,
opt => opt.PreCondition(src => !string.IsNullOrEmpty(src.Email)));
CreateMap<CreateReviewDto, Review>();
CreateMap<UpdateReviewDto, Review>();
CreateMap<UpdateReviewDto, Review>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
CreateMap<CreateLoanDto, Loan>();
CreateMap<UpdateLoanDto, Loan>();
CreateMap<UpdateLoanDto, Loan>()
.ForMember(dest => dest.Id, opt => opt.Ignore());
}
}