From ec6ddc8a23e1293f66527f1bb4b1181ebca04b22 Mon Sep 17 00:00:00 2001 From: Emad <121242386+esdd1995@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:08:39 -0700 Subject: [PATCH] [SPDBT-3138] fix cm-crc submit new error (#1474) --- .../ControllingMemberCrcApplication/Mappings.cs | 1 + .../PersonLicApplication/PersonLicApplicationRepository.cs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Spd.Resource.Repository/ControllingMemberCrcApplication/Mappings.cs b/src/Spd.Resource.Repository/ControllingMemberCrcApplication/Mappings.cs index 50e865a68..d629db12f 100644 --- a/src/Spd.Resource.Repository/ControllingMemberCrcApplication/Mappings.cs +++ b/src/Spd.Resource.Repository/ControllingMemberCrcApplication/Mappings.cs @@ -130,6 +130,7 @@ public Mappings() .IncludeBase(); _ = CreateMap() + .ForMember(d => d.contactid, opt => opt.MapFrom(s => s.ContactId == Guid.Empty ? Guid.NewGuid() : s.ContactId)) .IncludeBase(); _ = CreateMap() diff --git a/src/Spd.Resource.Repository/PersonLicApplication/PersonLicApplicationRepository.cs b/src/Spd.Resource.Repository/PersonLicApplication/PersonLicApplicationRepository.cs index 9ea8fa8a5..c1efe53a3 100644 --- a/src/Spd.Resource.Repository/PersonLicApplication/PersonLicApplicationRepository.cs +++ b/src/Spd.Resource.Repository/PersonLicApplication/PersonLicApplicationRepository.cs @@ -39,11 +39,13 @@ public async Task CreateLicenceApplicationAsync(Creat else existingContact = SharedRepositoryFuncs.GetDuplicateContact(_context, contact, ct); - //for new, create a new contact if it doesn't exist with same info, or update the licence holder contact if Has expired licence. + //for new, create a new contact if it doesn't exist with same info, or update the licence holder contact if Has expired licence. if (existingContact != null) contact = await _context.UpdateContact(existingContact, contact, null, _mapper.Map>(cmd.Aliases), ct); else + { contact = await _context.CreateContact(contact, null, _mapper.Map>(cmd.Aliases), ct); + } } else {