I have the following scenario:
[HttpPost]
public PartialViewResult Create(string dados)
{
var clienteViewModel = DeserializeJson<ClienteViewModel>(dados);
if (ModelState.IsValid) { } // Não têm como validar.
...
}
I get json and convert to the ClientViewModel object, but this way I can not validate with "ModelState.isValid" because it validates the template that is in the parameter.
I do not want to have to send the form normally to the Action and in its parameter put the ClientViewModel instead of the "data string (json)" as this causes the whole page to be loaded, and I do not want this. >
Is there a way to validate the ViewModel in this way?