We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ddafd9 commit c95cfdcCopy full SHA for c95cfdc
1 file changed
ManagedCode.Communication.Extensions/ControllerExtensions.cs
@@ -1,3 +1,4 @@
1
+using Microsoft.AspNetCore.Http;
2
using Microsoft.AspNetCore.Mvc;
3
4
namespace ManagedCode.Communication.Extensions;
@@ -8,4 +9,9 @@ public static IActionResult ToActionResult<T>(this Result<T> result)
8
9
{
10
return result.IsSuccess ? new OkObjectResult(result.Value) : new BadRequestObjectResult(result.GetError()?.Message);
11
}
12
+
13
+ public static Microsoft.AspNetCore.Http.IResult ToHttpResult<T>(this Result<T> result)
14
+ {
15
+ return result.IsSuccess ? Results.Ok(result.Value) : Results.BadRequest(result.GetError()?.Message);
16
+ }
17
0 commit comments