Corrected the nullable Id to non-nullable
This commit is contained in:
parent
b313f3ce70
commit
0275371556
@ -2761,11 +2761,11 @@ namespace Marco.Pms.Services.Service
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Validate if the employee Id from the URL path matches the Id in the request body (model)
|
// Validate if the employee Id from the URL path matches the Id in the request body (model)
|
||||||
if (id != model.Id || model.Id.HasValue)
|
if (id != model.Id)
|
||||||
{
|
{
|
||||||
// Log a warning with details for traceability when Ids do not match
|
// Log a warning with details for traceability when Ids do not match
|
||||||
_logger.LogWarning("Mismatch detected: Path parameter Id ({PathId}) does not match body Id ({BodyId}) for employee {EmployeeId}",
|
_logger.LogWarning("Mismatch detected: Path parameter Id ({PathId}) does not match body Id ({BodyId}) for employee {EmployeeId}",
|
||||||
id, model.Id ?? Guid.Empty, loggedInEmployee.Id);
|
id, model.Id, loggedInEmployee.Id);
|
||||||
|
|
||||||
// Return standardized error response with HTTP 400 Bad Request status and clear message
|
// Return standardized error response with HTTP 400 Bad Request status and clear message
|
||||||
return ApiResponse<object>.ErrorResponse("The employee Id in the path does not match the Id in the request body.",
|
return ApiResponse<object>.ErrorResponse("The employee Id in the path does not match the Id in the request body.",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user