ActionResult<T>
The return type of a controller action that can be either a typed success payload or another HTTP result, such as NotFound().
In more detail
An action can return a success value of type T or any other result, such as NotFound(), from the same method. It makes the status code explicit and documents the success type for OpenAPI.
Related terms
- controller — In ASP.NET Core, a class deriving from ControllerBase that groups related HTTP endpoints as methods called actions.
- action — A public method on a controller that handles requests for one route and returns a result.
- IResult — The type minimal API handlers return to describe an HTTP response, created with helpers such as Results.Ok(product) or Results.NotFound().
Taught in
- Building Routes with Controllers — Modern .NET Core, C# & Enterprise Microservices
- Comparing Controllers and Minimal APIs — Modern .NET Core, C# & Enterprise Microservices