ControllerBase.CreatedAtAction Method

Definition

Overloads

CreatedAtAction(String, Object)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates a CreatedAtActionResult object that produces a Status201Created response.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.CreatedAtActionResult CreatedAtAction (string actionName, object value);
C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.CreatedAtActionResult CreatedAtAction (string? actionName, object? value);

Parameters

actionName
String

The name of the action to use for generating the URL.

value
Object

The content value to format in the entity body.

Returns

The created CreatedAtActionResult for the response.

Attributes

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

CreatedAtAction(String, Object, Object)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates a CreatedAtActionResult object that produces a Status201Created response.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.CreatedAtActionResult CreatedAtAction (string actionName, object routeValues, object value);
C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.CreatedAtActionResult CreatedAtAction (string? actionName, object? routeValues, object? value);

Parameters

actionName
String

The name of the action to use for generating the URL.

routeValues
Object

The route data to use for generating the URL.

value
Object

The content value to format in the entity body.

Returns

The created CreatedAtActionResult for the response.

Attributes

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

CreatedAtAction(String, String, Object, Object)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates a CreatedAtActionResult object that produces a Status201Created response.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.CreatedAtActionResult CreatedAtAction (string actionName, string controllerName, object routeValues, object value);
C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.CreatedAtActionResult CreatedAtAction (string? actionName, string? controllerName, object? routeValues, object? value);

Parameters

actionName
String

The name of the action to use for generating the URL.

controllerName
String

The name of the controller to use for generating the URL.

routeValues
Object

The route data to use for generating the URL.

value
Object

The content value to format in the entity body.

Returns

The created CreatedAtActionResult for the response.

Attributes

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0