Am I missing something? I am trying to return model validation errors from my web api update method like this
public void Update public void UpdateModel(Models.Model entity) {
ModelState.AddModelError("name","error");
return;
However the JSON returned has no validation errors
For example in this article enter link description here
When I try to use a validation filter as in the previous article on this link I get the error Action xxxxx has one or more filters applied that do not derive from AuthorizationFilterAttribute. Only authorization filters are supported on DataController Insert/Update/Delete actions.
ModelStateisnt accessible from your JSON, unless you specifically serialize it as such. It’s more used from theHtmlHelperextensions behind the scenes. If you’re attempting to update the UI as if the model state was marked as such, you’re going about it all wrong. You can either: