Skip to content

Instantly share code, notes, and snippets.

@nunofilipecosta
Created October 25, 2013 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nunofilipecosta/7150918 to your computer and use it in GitHub Desktop.
Save nunofilipecosta/7150918 to your computer and use it in GitHub Desktop.
ModelState to String Array
var errorInModelState = this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors).Select(k => k.ErrorMessage);
return Request.CreateResponse(HttpStatusCode.BadRequest, errorInModelState);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment