init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
27
KretaWeb/Helpers/Extension/ModelStateExtension.cs
Normal file
27
KretaWeb/Helpers/Extension/ModelStateExtension.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Web.Http.ModelBinding;
|
||||
|
||||
namespace Kreta.Web.Helpers
|
||||
{
|
||||
public static class ModelStateExtension
|
||||
{
|
||||
public static void AddRange(this ModelStateDictionary modelStateDictionary, Dictionary<string, string> dictionary)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> item in dictionary)
|
||||
{
|
||||
modelStateDictionary.AddModelError(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddRange(this ModelStateDictionary modelStateDictionary, Dictionary<string, List<string>> dictionary)
|
||||
{
|
||||
foreach (KeyValuePair<string, List<string>> item in dictionary)
|
||||
{
|
||||
foreach (string value in item.Value)
|
||||
{
|
||||
modelStateDictionary.AddModelError(item.Key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue