diff --git a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs index 85ddaefe2..a947dd946 100644 --- a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs @@ -103,8 +103,7 @@ public class AuditDocumentService(IRepository _auditDocumentRepos /// private async Task AddOrUpdateAuditDocument(AuditDocumentAddOrEdit inDto) { - if (inDto.ParentId != null) - { + var alikeData = await _auditDocumentRepository.Where(x =>x.Id!=inDto.Id&& x.ParentId == inDto.ParentId&&x.Name==inDto.Name&&x.AuditDocumentTypeEnum==inDto.AuditDocumentTypeEnum).FirstOrDefaultAsync(); if (alikeData != null) { @@ -144,7 +143,7 @@ public class AuditDocumentService(IRepository _auditDocumentRepos return entityData; } } - } + var entity = await _auditDocumentRepository.InsertOrUpdateAsync(inDto, true); return entity;