readme added

This commit is contained in:
Stoyan Zlatev
2023-06-19 13:57:29 +02:00
parent 0e34632d17
commit 6e3930d2ec
3 changed files with 2 additions and 36 deletions
@@ -77,6 +77,7 @@
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="README.md" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1 @@

@@ -1,36 +0,0 @@
namespace LaaProductionWeb.App_Infrastructure
{
using System.Collections.Generic;
using System.Linq;
using WebAPIModelState = System.Web.Http.ModelBinding.ModelStateDictionary;
public class HttpErrorModel : Dictionary<string, object>
{
private HttpErrorModel()
{
}
public static implicit operator HttpErrorModel(WebAPIModelState modelStateDictionary)
{
var badRequestErrors = new HttpErrorModel();
foreach (var kvp in modelStateDictionary)
{
var errorKey = kvp.Key ?? string.Empty;
var errorValue = kvp.Value.Errors?.FirstOrDefault()?.ErrorMessage;
if (errorKey is null || errorValue is null)
{
continue;
}
badRequestErrors[errorKey] = errorValue;
}
return badRequestErrors;
}
}
}