Skip to content

Instantly share code, notes, and snippets.

@vpetkovic
Last active September 26, 2019 13:32
Show Gist options
  • Save vpetkovic/cf3ddf701759fa49425169e7c188e3ce to your computer and use it in GitHub Desktop.
Save vpetkovic/cf3ddf701759fa49425169e7c188e3ce to your computer and use it in GitHub Desktop.
The following table lists all the methods of ApiController class that returns an object of a class that implements IHttpActionResult interface.
- **BadRequest()**: Creates a BadRequestResult object with status code 400.
- **Conflict()**: Creates a ConflictResult object with status code 409.
- **Content()**: Creates a NegotiatedContentResult with the specified status code and data.
- **Created()**: Creates a CreatedNegotiatedContentResult with status code 201 Created.
- **CreatedAtRoute()**: Creates a CreatedAtRouteNegotiatedContentResult with status code 201 created.
- **InternalServerError()**: Creates an InternalServerErrorResult with status code 500 Internal server error.
- **NotFound()**: Creates a NotFoundResult with status code404.
- **Ok()**: Creates an OkResult with status code 200.
- **Redirect()**: Creates a RedirectResult with status code 302.
- **RedirectToRoute()**: Creates a RedirectToRouteResult with status code 302.
- **ResponseMessage()**: Creates a ResponseMessageResult with the specified HttpResponseMessage.
- **StatusCode()**: Creates a StatusCodeResult with the specified http status code.
- **Unauthorized()**: Creates an UnauthorizedResult with status code 401.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment