I have a ASP.NET MVC application that makes calls to my ASP.NET Web API layer.
The Web API layer also uses EF 6.x (latest).
Now when e.g. say the MVC has a user form to create a new user, when the user hits submit I do:
- The form is backed by my UserDTO
- Pass the UserDTO as a parameter to my SaveUser web-api client.
Now in the Web API layer, if there is a validation error, how can I use attribute based validation and pass the error back to the MVC view page?
Update
I want to use ModelState.IsValid and if there are errors pass those back to the MVC layer.
ValidationResult
then imo.