I\'m working on a service in WebAPI 2, and the endpoint currently returns an IHttpActionResult
. I\'d like to return a status code 422
, but since it\'s
I use this way simple and elegant.
public ActionResult Validate(User user)
{
return new HttpStatusCodeResult((HttpStatusCode)500,
"My custom internal server error.");
}
Then angular controller.
function errorCallBack(response) {
$scope.response = {
code: response.status,
text: response.statusText
}});
Hope it helps you.