ApiController ApiController ApiController Class

Definition

[Microsoft.AspNetCore.Mvc.Controller]
[Microsoft.AspNetCore.Mvc.WebApiCompatShim.UseWebApiActionConventions]
[Microsoft.AspNetCore.Mvc.WebApiCompatShim.UseWebApiOverloading]
[Microsoft.AspNetCore.Mvc.WebApiCompatShim.UseWebApiParameterConventions]
[Microsoft.AspNetCore.Mvc.WebApiCompatShim.UseWebApiRoutes]
public abstract class ApiController : IDisposable
type ApiController = class
    interface IDisposable
Public MustInherit Class ApiController
Implements IDisposable
Inheritance
ApiControllerApiControllerApiController
Attributes
Implements

Constructors

ApiController() ApiController() ApiController()

Properties

ActionContext ActionContext ActionContext

Gets the ActionContext.

Context Context Context

Gets the http context.

ControllerContext ControllerContext ControllerContext

Gets or sets the ControllerContext.

MetadataProvider MetadataProvider MetadataProvider

Gets the IModelMetadataProvider.

ModelState ModelState ModelState

Gets model state after the model binding process. This ModelState will be empty before model binding happens.

ObjectValidator ObjectValidator ObjectValidator

Gets or sets the IObjectModelValidator.

Request Request Request

Gets or sets the HTTP request message.

Url Url Url

Gets a factory used to generate URLs to other APIs.

User User User

Gets or sets the current principal associated with this request.

Methods

BadRequest() BadRequest() BadRequest()

Creates a BadRequestResult (400 Bad Request).

BadRequest(ModelStateDictionary) BadRequest(ModelStateDictionary) BadRequest(ModelStateDictionary)

Creates an InvalidModelStateResult (400 Bad Request) with the specified model state.

BadRequest(String) BadRequest(String) BadRequest(String)

Creates a BadRequestErrorMessageResult (400 Bad Request) with the specified error message.

Conflict() Conflict() Conflict()

Creates a ConflictResult (409 Conflict).

Content<T>(HttpStatusCode, T) Content<T>(HttpStatusCode, T) Content<T>(HttpStatusCode, T)

Creates a NegotiatedContentResult<T> with the specified values.

Created(String, Object) Created(String, Object) Created(String, Object)

Creates a CreatedResult (201 Created) with the specified values.

Created(Uri, Object) Created(Uri, Object) Created(Uri, Object)

Creates a CreatedResult (201 Created) with the specified values.

CreatedAtRoute(String, Object, Object) CreatedAtRoute(String, Object, Object) CreatedAtRoute(String, Object, Object)

Creates a CreatedAtRouteResult (201 Created) with the specified values.

Dispose() Dispose() Dispose()
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)
InternalServerError() InternalServerError() InternalServerError()

Creates an InternalServerErrorResult (500 Internal Server Error).

InternalServerError(Exception) InternalServerError(Exception) InternalServerError(Exception)

Creates an ExceptionResult (500 Internal Server Error) with the specified exception.

Json<T>(T, JsonSerializerSettings, Encoding) Json<T>(T, JsonSerializerSettings, Encoding) Json<T>(T, JsonSerializerSettings, Encoding)

Creates an JsonResult (200 OK) with the specified values.

Json<T>(T, JsonSerializerSettings) Json<T>(T, JsonSerializerSettings) Json<T>(T, JsonSerializerSettings)

Creates an JsonResult (200 OK) with the specified values.

Json<T>(T) Json<T>(T) Json<T>(T)

Creates an JsonResult (200 OK) with the specified value.

NotFound() NotFound() NotFound()

Creates an NotFoundResult (404 Not Found).

Ok() Ok() Ok()

Creates an OkResult (200 OK).

Ok<T>(T) Ok<T>(T) Ok<T>(T)

Creates an OkObjectResult (200 OK) with the specified values.

Redirect(Uri) Redirect(Uri) Redirect(Uri)

Creates a RedirectResult (302 Found) with the specified value.

Redirect(String) Redirect(String) Redirect(String)

Creates a RedirectResult (302 Found) with the specified value.

RedirectToRoute(String, Object) RedirectToRoute(String, Object) RedirectToRoute(String, Object)

Creates a RedirectToRouteResult (302 Found) with the specified values.

ResponseMessage(HttpResponseMessage) ResponseMessage(HttpResponseMessage) ResponseMessage(HttpResponseMessage)

Creates a ResponseMessageResult with the specified response.

StatusCode(HttpStatusCode) StatusCode(HttpStatusCode) StatusCode(HttpStatusCode)

Creates a StatusCodeResult with the specified status code.

Validate<TEntity>(TEntity) Validate<TEntity>(TEntity) Validate<TEntity>(TEntity)

Validates the given entity and adds the validation errors to the ModelState under an empty prefix.

Validate<TEntity>(TEntity, String) Validate<TEntity>(TEntity, String) Validate<TEntity>(TEntity, String)

Validates the given entity and adds the validation errors to the ModelState.

Applies to