This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View 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);
}
}
}
}
}