From c27b2a2ff137b1bf2cdc6ec29f1b4a4c8f0fba0f Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 3 Sep 2025 14:50:03 +0530 Subject: [PATCH] Added the check to check the system defined types --- Marco.Pms.Services/Service/MasterService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);