mirror of
https://github.com/bitwarden/server.git
synced 2026-02-14 21:03:51 +08:00
17 lines
401 B
C#
17 lines
401 B
C#
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|||
|
|
|
|||
|
|
namespace Bit.Core.Utilities;
|
|||
|
|
|
|||
|
|
public static class ModelStateExtensions
|
|||
|
|
{
|
|||
|
|
public static string GetErrorMessage(this ModelStateDictionary modelState)
|
|||
|
|
{
|
|||
|
|
var errors = modelState.Values
|
|||
|
|
.SelectMany(v => v.Errors)
|
|||
|
|
.Select(e => e.ErrorMessage)
|
|||
|
|
.ToList();
|
|||
|
|
|
|||
|
|
return string.Join("; ", errors);
|
|||
|
|
}
|
|||
|
|
}
|