From db544239eafcef40883c1651be6fec56d23bfca1 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Sat, 17 May 2025 12:28:54 +0530 Subject: [PATCH] Refetched the contact in update contact API --- Marco.Pms.Services/Helpers/DirectoryHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marco.Pms.Services/Helpers/DirectoryHelper.cs b/Marco.Pms.Services/Helpers/DirectoryHelper.cs index 883ab63..ff3f730 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -393,6 +393,7 @@ namespace Marco.Pms.Services.Helpers } var newContact = updateContact.ToContactFromUpdateContactDto(tenantId); + _context.Contacts.Update(newContact); List phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); var phoneIds = phones.Select(p => p.Id).ToList(); @@ -573,6 +574,7 @@ namespace Marco.Pms.Services.Helpers await _context.SaveChangesAsync(); + contact = await _context.Contacts.Include(c => c.ContactCategory).FirstOrDefaultAsync(c => c.Id == id && c.IsActive && c.TenantId == tenantId) ?? new Contact(); phones = await _context.ContactsPhones.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); emails = await _context.ContactsEmails.AsNoTracking().Where(p => p.ContactId == contact.Id).ToListAsync(); contactTags = await _context.ContactTagMappings.AsNoTracking().Where(m => m.ContactId == contact.Id).ToListAsync();