Is it possible to add model state error message during updating properties using TryUpdateModel? I would like to detect if exception was throw during updating one of my (view)model properties and if so I would like to add model state error message.
I would like to do something like this:
throw new ValidationException("some message");
and then I would like to display the message without having to explicitly setting:
ModelState.AddModelError("", exception.Message);
in my controller.
TryUpdateModel already adds modelstate errors for each validation failure it encounters.