ModelState.IsValid
will be false if the validation for the Model failed.
- You have DataAnnotation which failed the incoming model.
- You added custom validations.
- Make sure there are no null entries in the model for non null properties
Check the ModelState.Errors
for what is the reason causing this. You can use this:
var errors = ModelState.Values.SelectMany(v => v.Errors);