We all are aware that when we take any model from view(user input) into the controller , we always tend to
But the same is not applicable when we are doing same in class file which does not inherit controller class.
For that we have to use GetValidationErrors() to validate if we are good with data models & should only proceed into database insertion once there are no errors ( GetValidationErrors().Count() ).
use ModelState.IsValid to check if model is valid , then only we will proceed for further processing
But the same is not applicable when we are doing same in class file which does not inherit controller class.
For that we have to use GetValidationErrors() to validate if we are good with data models & should only proceed into database insertion once there are no errors ( GetValidationErrors().Count() ).