diff --git a/backend/Src/PIED_LMS.Application/UserCases/Commands/Identity/UpdateProfileHandler.cs b/backend/Src/PIED_LMS.Application/UserCases/Commands/Identity/UpdateProfileHandler.cs index f3510209..53596dec 100644 --- a/backend/Src/PIED_LMS.Application/UserCases/Commands/Identity/UpdateProfileHandler.cs +++ b/backend/Src/PIED_LMS.Application/UserCases/Commands/Identity/UpdateProfileHandler.cs @@ -63,7 +63,7 @@ public async Task> Handle(UpdateProfileCommand request, return new ServiceResponse(false, "Failed to update profile"); } - return new ServiceResponse(true, "Profile updated successfully"); + return new ServiceResponse(true, "Profile updated successfully", "Profile updated successfully"); } catch (Exception ex) { diff --git a/backend/Src/PIED_LMS.Presentation/Extensions/EndpointExtensions.cs b/backend/Src/PIED_LMS.Presentation/Extensions/EndpointExtensions.cs index 8cc73a52..79d9f3e8 100644 --- a/backend/Src/PIED_LMS.Presentation/Extensions/EndpointExtensions.cs +++ b/backend/Src/PIED_LMS.Presentation/Extensions/EndpointExtensions.cs @@ -8,9 +8,6 @@ public static IResult ToActionResult(this ServiceResponse result, HttpCont { if (result.Success) { - if (result.Data is null && typeof(T).IsClass) - return Results.NotFound(result); - return Results.Ok(result); } @@ -25,7 +22,7 @@ public static IResult ToActionResult(this ServiceResponse result, HttpCont return Results.Json(result, statusCode: StatusCodes.Status401Unauthorized); if (result.ErrorCode == "FORBIDDEN" || result.ErrorCode == "ACCESS_DENIED" || - (result.Message.Contains("authorized") || result.Message.Contains("permission"))) + (result.Message is not null && (result.Message.Contains("authorized") || result.Message.Contains("permission")))) return Results.Json(result, statusCode: StatusCodes.Status403Forbidden); return result.ErrorCode switch