Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58a19fd

Browse filesBrowse files
committed
library
1 parent ce92e50 commit 58a19fd
Copy full SHA for 58a19fd

4 files changed

+42Lines changed: 42 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace ManagedCode.Communication.Extensions;
4+
5+
public static class ControllerExtensions
6+
{
7+
public static IActionResult ToActionResult<T>(this Result<T> result)
8+
{
9+
return result.IsSuccess ? new OkObjectResult(result.Value) : new BadRequestObjectResult(result.Error);
10+
}
11+
}
Collapse file
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<LangVersion>11</LangVersion>
5+
<Nullable>enable</Nullable>
6+
<IsPackable>true</IsPackable>
7+
<TargetFrameworks>net6.0;net7.0;</TargetFrameworks>
8+
<RootNamespace>ManagedCode.Communication.Extensions</RootNamespace>
9+
<OutputType>Library</OutputType>
10+
</PropertyGroup>
11+
12+
<!--NuGet-->
13+
<PropertyGroup>
14+
<Title>ManagedCode.Communication.Extensions</Title>
15+
<PackageId>ManagedCode.Communication.Extensions</PackageId>
16+
<Description>Communication for .NET</Description>
17+
<PackageTags>managedcode, Communication, Result</PackageTags>
18+
</PropertyGroup>
19+
20+
<ItemGroup>
21+
<ProjectReference Include="..\ManagedCode.Communication\ManagedCode.Communication.csproj" />
22+
</ItemGroup>
23+
24+
</Project>
Collapse file

‎ManagedCode.Communication.sln‎

Copy file name to clipboardExpand all lines: ManagedCode.Communication.sln
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedCode.Communication.O
88
EndProject
99
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedCode.Communication.Benchmark", "ManagedCode.Communication.Benchmark\ManagedCode.Communication.Benchmark.csproj", "{5D4F8912-B080-467C-A98D-3BADB7BD89E1}"
1010
EndProject
11+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedCode.Communication.Extensions", "ManagedCode.Communication.Extensions\ManagedCode.Communication.Extensions.csproj", "{63DCDAE6-F337-4A36-9589-3391D195C4D7}"
12+
EndProject
1113
Global
1214
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1315
Debug|Any CPU = Debug|Any CPU
@@ -34,5 +36,9 @@ Global
3436
{5D4F8912-B080-467C-A98D-3BADB7BD89E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
3537
{5D4F8912-B080-467C-A98D-3BADB7BD89E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
3638
{5D4F8912-B080-467C-A98D-3BADB7BD89E1}.Release|Any CPU.Build.0 = Release|Any CPU
39+
{63DCDAE6-F337-4A36-9589-3391D195C4D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40+
{63DCDAE6-F337-4A36-9589-3391D195C4D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
41+
{63DCDAE6-F337-4A36-9589-3391D195C4D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
42+
{63DCDAE6-F337-4A36-9589-3391D195C4D7}.Release|Any CPU.Build.0 = Release|Any CPU
3743
EndGlobalSection
3844
EndGlobal
Collapse file

‎ManagedCode.Communication/Extensions/HttpResponseExtension.cs‎

Copy file name to clipboardExpand all lines: ManagedCode.Communication/Extensions/HttpResponseExtension.cs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ public static async Task<Result> FromRequestToResult(this HttpResponseMessage re
2424
var content = await responseMessage.Content.ReadAsStringAsync();
2525
return Result.Fail(Error.Create(content, responseMessage.StatusCode));
2626
}
27+
2728
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.