From a00ef4313a224329578c562fa8cbfd442cd91574 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 bbef1a2..7a26a38 100644 --- a/Marco.Pms.Services/Helpers/DirectoryHelper.cs +++ b/Marco.Pms.Services/Helpers/DirectoryHelper.cs @@ -1732,6 +1732,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(); @@ -1912,6 +1913,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();