diff --git a/Marco.Pms.Services/Service/MasterService.cs b/Marco.Pms.Services/Service/MasterService.cs index b60f399..9de13fc 100644 --- a/Marco.Pms.Services/Service/MasterService.cs +++ b/Marco.Pms.Services/Service/MasterService.cs @@ -1371,7 +1371,11 @@ namespace Marco.Pms.Services.Service _logger.LogWarning("Employee {EmployeeId} tries to {Action} Document Type, but not found in database", loggedInEmployee.Id, action); return ApiResponse.ErrorResponse("Document Type not found", "Document Type not found", 404); } - + if (documentType.IsSystem) + { + _logger.LogWarning("Employee {EmployeeId} tries to {Action} Document Type, but could not take action on system defined entity", loggedInEmployee.Id, action); + return ApiResponse.ErrorResponse($"Document is system defined cannot be {action}d", $"Document is system defined cannot be {action}d", 400); + } // Mapping DocumentTypeMatser to BsonDocument var existingEntityBson = _updateLogHelper.EntityToBsonDocument(documentType);