asp.net MVC里的 ModelState使用方法
https://www.cnblogs.com/hohoa/p/5839993.html
if (!ModelState.IsValid)
{
string error = string.Empty;
foreach (var key in ModelState.Keys)
{
var state = ModelState[key];
if (state.Errors.Any())
{
error = state.Errors.First().ErrorMessage;
break;
}
}
return ApiResponse(new ReturnMessage() { Status = ResultStatus.Failed, Message = error });
}
如果你们发现了其他的用发,请联系一下我!谢谢