Return Custom ValidationResult and access it from controller ModalState in Asp.Net Core

84 views Asked by At

I have same issue as mentioned in this question long back. Return Custom ValidationResult and access it from controller in Asp.Net Core

But it didn't concluded with an answer. Please suggest a way to get CustomValidationResult into ModelState of controller. Note: I am not trying to create new action filters. i am trying to work with ValidationResult, ValidationAttribute and ModelState.

i created a class for

CustomValidationResult : ValidationResult

Using this in my custom attribute

Mandatory : RequiredAttribute

This is not reflecting back to controller level ModelState for further validation.

0

There are 0 answers