diff --git a/Marco.Pms.Services/Controllers/DocumentController.cs b/Marco.Pms.Services/Controllers/DocumentController.cs index f450c41..8bd52cd 100644 --- a/Marco.Pms.Services/Controllers/DocumentController.cs +++ b/Marco.Pms.Services/Controllers/DocumentController.cs @@ -705,13 +705,6 @@ namespace Marco.Pms.Services.Controllers return NotFound(ApiResponse.ErrorResponse($"{(entityType == EmployeeEntity ? "Employee" : "Project")} Not Found", "Entity not found in database", 404)); } - var isDocumentExist = await _context.DocumentAttachments.AnyAsync(da => da.DocumentId == model.DocumentId && da.TenantId == tenantId); - if (isDocumentExist) - { - _logger.LogWarning("{DocumentId} is already existed in database", model.DocumentId ?? string.Empty); - return StatusCode(409, ApiResponse.ErrorResponse("Document already existed", "Document already existed in database", 409)); - } - // Map DTO to DB entity var attachment = _mapper.Map(model); attachment.UploadedAt = DateTime.UtcNow; @@ -1108,13 +1101,6 @@ namespace Marco.Pms.Services.Controllers return NotFound(ApiResponse.ErrorResponse($"{(entityType == EmployeeEntity ? "Employee" : "Project")} Not Found", "Entity not found in database", 404)); } - var isDocumentExist = await _context.DocumentAttachments.AnyAsync(da => da.Id != model.Id && da.DocumentId == model.DocumentId && da.TenantId == tenantId); - if (isDocumentExist) - { - _logger.LogWarning("{DocumentId} is already existed in database", model.DocumentId ?? string.Empty); - return StatusCode(409, ApiResponse.ErrorResponse("Document already existed", "Document already existed in database", 409)); - } - // Prepare for versioning var oldVersionMapping = await _context.AttachmentVersionMappings .FirstOrDefaultAsync(av => av.ChildAttachmentId == oldAttachment.Id && av.TenantId == tenantId);