Added the new condition while checking the document category or type by name

This commit is contained in:
ashutosh.nehete 2025-09-03 12:51:07 +05:30
parent 9b3324c27c
commit 4c2b33472b

View File

@ -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);