readme added
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user