diff --git a/src/Microsoft.AspNetCore.Mvc.Core/AcceptedAtActionResult.cs b/src/Microsoft.AspNetCore.Mvc.Core/AcceptedAtActionResult.cs
new file mode 100644
index 0000000000..aea31ae127
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Core/AcceptedAtActionResult.cs
@@ -0,0 +1,94 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.Core;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.AspNetCore.Mvc.Routing;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Net.Http.Headers;
+
+namespace Microsoft.AspNetCore.Mvc
+{
+ ///
+ /// An that returns a Accepted (202) response with a Location header.
+ ///
+ public class AcceptedAtActionResult : ObjectResult
+ {
+ ///
+ /// Initializes a new instance of the with the values
+ /// provided.
+ ///
+ /// The name of the action to use for generating the URL.
+ /// The name of the controller to use for generating the URL.
+ /// The route data to use for generating the URL.
+ /// The value to format in the entity body.
+ public AcceptedAtActionResult(
+ string actionName,
+ string controllerName,
+ object routeValues,
+ object value)
+ : base(value)
+ {
+ ActionName = actionName;
+ ControllerName = controllerName;
+ RouteValues = routeValues == null ? null : new RouteValueDictionary(routeValues);
+ StatusCode = StatusCodes.Status202Accepted;
+ }
+
+ ///
+ /// Gets or sets the used to generate URLs.
+ ///
+ public IUrlHelper UrlHelper { get; set; }
+
+ ///
+ /// Gets or sets the name of the action to use for generating the URL.
+ ///
+ public string ActionName { get; set; }
+
+ ///
+ /// Gets or sets the name of the controller to use for generating the URL.
+ ///
+ public string ControllerName { get; set; }
+
+ ///
+ /// Gets or sets the route data to use for generating the URL.
+ ///
+ public RouteValueDictionary RouteValues { get; set; }
+
+ ///
+ public override void OnFormatting(ActionContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ base.OnFormatting(context);
+
+ var request = context.HttpContext.Request;
+
+ var urlHelper = UrlHelper;
+ if (urlHelper == null)
+ {
+ var services = context.HttpContext.RequestServices;
+ urlHelper = services.GetRequiredService().GetUrlHelper(context);
+ }
+
+ var url = urlHelper.Action(
+ ActionName,
+ ControllerName,
+ RouteValues,
+ request.Scheme,
+ request.Host.ToUriComponent());
+
+ if (string.IsNullOrEmpty(url))
+ {
+ throw new InvalidOperationException(Resources.NoRoutesMatched);
+ }
+
+ context.HttpContext.Response.Headers[HeaderNames.Location] = url;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/AcceptedAtRouteResult.cs b/src/Microsoft.AspNetCore.Mvc.Core/AcceptedAtRouteResult.cs
new file mode 100644
index 0000000000..bfde81d3ae
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Core/AcceptedAtRouteResult.cs
@@ -0,0 +1,90 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.Core;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.AspNetCore.Mvc.Routing;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Net.Http.Headers;
+
+namespace Microsoft.AspNetCore.Mvc
+{
+ ///
+ /// An that returns a Accepted (202) response with a Location header.
+ ///
+ public class AcceptedAtRouteResult : ObjectResult
+ {
+ ///
+ /// Initializes a new instance of the class with the values
+ /// provided.
+ ///
+ /// The route data to use for generating the URL.
+ /// The value to format in the entity body.
+ public AcceptedAtRouteResult(object routeValues, object value)
+ : this(routeName: null, routeValues: routeValues, value: value)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class with the values
+ /// provided.
+ ///
+ /// The name of the route to use for generating the URL.
+ /// The route data to use for generating the URL.
+ /// The value to format in the entity body.
+ public AcceptedAtRouteResult(
+ string routeName,
+ object routeValues,
+ object value)
+ : base(value)
+ {
+ RouteName = routeName;
+ RouteValues = routeValues == null ? null : new RouteValueDictionary(routeValues);
+ StatusCode = StatusCodes.Status202Accepted;
+ }
+
+ ///
+ /// Gets or sets the used to generate URLs.
+ ///
+ public IUrlHelper UrlHelper { get; set; }
+
+ ///
+ /// Gets or sets the name of the route to use for generating the URL.
+ ///
+ public string RouteName { get; set; }
+
+ ///
+ /// Gets or sets the route data to use for generating the URL.
+ ///
+ public RouteValueDictionary RouteValues { get; set; }
+
+ ///
+ public override void OnFormatting(ActionContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ base.OnFormatting(context);
+
+ var urlHelper = UrlHelper;
+ if (urlHelper == null)
+ {
+ var services = context.HttpContext.RequestServices;
+ urlHelper = services.GetRequiredService().GetUrlHelper(context);
+ }
+
+ var url = urlHelper.Link(RouteName, RouteValues);
+
+ if (string.IsNullOrEmpty(url))
+ {
+ throw new InvalidOperationException(Resources.NoRoutesMatched);
+ }
+
+ context.HttpContext.Response.Headers[HeaderNames.Location] = url;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/AcceptedResult.cs b/src/Microsoft.AspNetCore.Mvc.Core/AcceptedResult.cs
new file mode 100644
index 0000000000..ce6f7cb72f
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Core/AcceptedResult.cs
@@ -0,0 +1,98 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Net.Http.Headers;
+
+namespace Microsoft.AspNetCore.Mvc
+{
+ ///
+ /// An that returns an Accepted (202) response with a Location header.
+ ///
+ public class AcceptedResult : ObjectResult
+ {
+ private string _location;
+
+ ///
+ /// Initializes a new instance of the class with the values
+ /// provided.
+ ///
+ public AcceptedResult()
+ : base(value: null)
+ {
+ StatusCode = StatusCodes.Status202Accepted;
+ }
+
+ ///
+ /// Initializes a new instance of the class with the values
+ /// provided.
+ ///
+ /// The location at which the status of requested content can be monitored.
+ /// The value to format in the entity body.
+ public AcceptedResult(string location, object value)
+ : base(value)
+ {
+ Location = location;
+ StatusCode = StatusCodes.Status202Accepted;
+ }
+
+ ///
+ /// Initializes a new instance of the class with the values
+ /// provided.
+ ///
+ /// The location at which the status of requested content can be monitored
+ /// It is an optional paramater and may be null
+ /// The value to format in the entity body.
+ public AcceptedResult(Uri locationUri, object value)
+ : base(value)
+ {
+ if (locationUri == null)
+ {
+ throw new ArgumentNullException(nameof(locationUri));
+ }
+
+ if (locationUri.IsAbsoluteUri)
+ {
+ Location = locationUri.AbsoluteUri;
+ }
+ else
+ {
+ Location = locationUri.GetComponents(UriComponents.SerializationInfoString, UriFormat.UriEscaped);
+ }
+
+ StatusCode = StatusCodes.Status202Accepted;
+ }
+
+ ///
+ /// Gets or sets the location at which the status of the requested content can be monitored.
+ ///
+ public string Location
+ {
+ get
+ {
+ return _location;
+ }
+ set
+ {
+ _location = value;
+ }
+ }
+
+ ///
+ public override void OnFormatting(ActionContext context)
+ {
+ if (context == null)
+ {
+ throw new ArgumentNullException(nameof(context));
+ }
+
+ base.OnFormatting(context);
+
+ if (!string.IsNullOrEmpty(Location))
+ {
+ context.HttpContext.Response.Headers[HeaderNames.Location] = Location;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs b/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs
index 64aef4bd5d..5fc7b1257d 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs
@@ -910,6 +910,223 @@ namespace Microsoft.AspNetCore.Mvc
return new CreatedAtRouteResult(routeName, routeValues, value);
}
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedResult Accepted()
+ {
+ return new AcceptedResult();
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The optional content value to format in the entity body; may be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedResult Accepted(object value)
+ {
+ return new AcceptedResult(location: null, value: value);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The optional URI with the location at which the status of requested content can be monitored.
+ /// May be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedResult Accepted(Uri uri)
+ {
+ if (uri == null)
+ {
+ throw new ArgumentNullException(nameof(uri));
+ }
+
+ return new AcceptedResult(locationUri: uri, value: null);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The optional URI with the location at which the status of requested content can be monitored.
+ /// May be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedResult Accepted(string uri)
+ {
+ return new AcceptedResult(location: uri, value: null);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The URI with the location at which the status of requested content can be monitored.
+ /// The optional content value to format in the entity body; may be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedResult Accepted(string uri, object value)
+ {
+ return new AcceptedResult(uri, value);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The URI with the location at which the status of requested content can be monitored.
+ /// The optional content value to format in the entity body; may be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedResult Accepted(Uri uri, object value)
+ {
+ if (uri == null)
+ {
+ throw new ArgumentNullException(nameof(uri));
+ }
+
+ return new AcceptedResult(locationUri: uri, value: value);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the action to use for generating the URL.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtActionResult AcceptedAtAction(string actionName)
+ {
+ return AcceptedAtAction(actionName, routeValues: null, value: null);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the action to use for generating the URL.
+ /// The name of the controller to use for generating the URL.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtActionResult AcceptedAtAction(string actionName, string controllerName)
+ {
+ return AcceptedAtAction(actionName, controllerName, routeValues: null, value: null);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the action to use for generating the URL.
+ /// The optional content value to format in the entity body; may be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtActionResult AcceptedAtAction(string actionName, object value)
+ {
+ return AcceptedAtAction(actionName, routeValues: null, value: value);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the action to use for generating the URL.
+ /// The name of the controller to use for generating the URL.
+ /// The route data to use for generating the URL.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtActionResult AcceptedAtAction(string actionName, string controllerName, object routeValues)
+ {
+ return AcceptedAtAction(actionName, controllerName, routeValues, value: null);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the action to use for generating the URL.
+ /// The route data to use for generating the URL.
+ /// The optional content value to format in the entity body; may be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtActionResult AcceptedAtAction(string actionName, object routeValues, object value)
+ {
+ return AcceptedAtAction(actionName, controllerName: null, routeValues: routeValues, value: value);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the action to use for generating the URL.
+ /// The name of the controller to use for generating the URL.
+ /// The route data to use for generating the URL.
+ /// The optional content value to format in the entity body; may be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtActionResult AcceptedAtAction(
+ string actionName,
+ string controllerName,
+ object routeValues,
+ object value)
+ {
+ return new AcceptedAtActionResult(actionName, controllerName, routeValues, value);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The route data to use for generating the URL.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtRouteResult AcceptedAtRoute(object routeValues)
+ {
+ return AcceptedAtRoute(routeName: null, routeValues: routeValues, value: null);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the route to use for generating the URL.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtRouteResult AcceptedAtRoute(string routeName)
+ {
+ return AcceptedAtRoute(routeName, routeValues: null, value: null);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the route to use for generating the URL.
+ ///The route data to use for generating the URL.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtRouteResult AcceptedAtRoute(string routeName, object routeValues)
+ {
+ return AcceptedAtRoute(routeName, routeValues, value: null);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The route data to use for generating the URL.
+ /// The optional content value to format in the entity body; may be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtRouteResult AcceptedAtRoute(object routeValues, object value)
+ {
+ return AcceptedAtRoute(routeName: null, routeValues: routeValues, value: value);
+ }
+
+ ///
+ /// Creates a object that produces an Accepted (202) response.
+ ///
+ /// The name of the route to use for generating the URL.
+ /// The route data to use for generating the URL.
+ /// The optional content value to format in the entity body; may be null.
+ /// The created for the response.
+ [NonAction]
+ public virtual AcceptedAtRouteResult AcceptedAtRoute(string routeName, object routeValues, object value)
+ {
+ return new AcceptedAtRouteResult(routeName, routeValues, value);
+ }
+
///
/// Creates a .
///
diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedAtActionResultTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedAtActionResultTests.cs
new file mode 100644
index 0000000000..e42c8712d5
--- /dev/null
+++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/AcceptedAtActionResultTests.cs
@@ -0,0 +1,188 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Buffers;
+using System.IO;
+using System.Text;
+using System.Threading.Tasks;
+using System.Net.Http;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.Abstractions;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Microsoft.AspNetCore.Mvc.Internal;
+using Microsoft.AspNetCore.Mvc.Routing;
+using Microsoft.AspNetCore.Routing;
+using Microsoft.AspNetCore.Testing;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging.Testing;
+using Moq;
+using Newtonsoft.Json;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Mvc
+{
+ public class AcceptedAtActionResultTests
+ {
+ public static TheoryData