From 4c2b33472b5ff00e50c4045120c2384b6a9c9147 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 3 Sep 2025 12:51:07 +0530 Subject: [PATCH] Added the new condition while checking the document category or type by name --- Marco.Pms.Services/Service/MasterService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marco.Pms.Services/Service/MasterService.cs b/Marco.Pms.Services/Service/MasterService.cs index 1e3ede3..26e642b 100644 --- a/Marco.Pms.Services/Service/MasterService.cs +++ b/Marco.Pms.Services/Service/MasterService.cs @@ -1032,7 +1032,7 @@ namespace Marco.Pms.Services.Service var oldCategoryExistsTask = Task.Run(async () => { await using var context = await _dbContextFactory.CreateDbContextAsync(); - return await context.DocumentCategoryMasters.AnyAsync(dc => dc.Name == model.Name && dc.EntityTypeId == model.EntityTypeId && dc.TenantId == tenantId); + return await context.DocumentCategoryMasters.AnyAsync(dc => dc.Name == model.Name && dc.Id != model.Id.Value && dc.EntityTypeId == model.EntityTypeId && dc.TenantId == tenantId); }); await Task.WhenAll(categoryTask, oldCategoryExistsTask); @@ -1287,7 +1287,7 @@ namespace Marco.Pms.Services.Service { await using var context = await _dbContextFactory.CreateDbContextAsync(); return await context.DocumentTypeMasters - .AnyAsync(dt => dt.Name == model.Name && dt.DocumentCategoryId == model.DocumentCategoryId && dt.TenantId == tenantId); + .AnyAsync(dt => dt.Name == model.Name && dt.Id != model.Id.Value && dt.DocumentCategoryId == model.DocumentCategoryId && dt.TenantId == tenantId); }); await Task.WhenAll(documentTypeTask, oldTypeExistsTask);