Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Returning a list of keys with ModelState errors

How can I return a list/array of all keys that have an error?

I have tried to do the below, but it says I can't have that sort of expression for some reason.

ModelState.ToList(item => item.Value.Errors.Count > 0)
like image 339
Jon Avatar asked May 20 '09 15:05

Jon


1 Answers

var errors = from modelstate in ModelState.AsQueryable().Where(f => f.Value.Errors.Count > 0) select new  {  Title = modelstate.Key  };
like image 177
Jon Avatar answered Nov 15 '22 04:11

Jon