Skip to content

Instantly share code, notes, and snippets.

@angelyordanov
Created September 12, 2018 08:37
Show Gist options
  • Save angelyordanov/000307989c76cbc3578a3c2445ce66ec to your computer and use it in GitHub Desktop.
Save angelyordanov/000307989c76cbc3578a3c2445ce66ec to your computer and use it in GitHub Desktop.
var modelState = actionContextAccessor.ActionContext.ModelState;
modelState.AddModelError(
nameof(data.UserVersion),
$"The {nameof(data.UserVersion)} field is required.");
return new BadRequestObjectResult(modelState);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment