diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionResultHelper.cs b/src/Microsoft.AspNet.Mvc.Core/ActionResultHelper.cs index d15a2dc6e7..3099dc07b3 100644 --- a/src/Microsoft.AspNet.Mvc.Core/ActionResultHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Core/ActionResultHelper.cs @@ -1,4 +1,5 @@ using System; +using System.Text; using Microsoft.AspNet.Mvc.Rendering; namespace Microsoft.AspNet.Mvc @@ -31,6 +32,16 @@ namespace Microsoft.AspNet.Mvc }; } + public IActionResult Content(string value, string contentType, Encoding contentEncoding) + { + return new ContentResult + { + Content = value, + ContentType = contentType, + ContentEncoding = contentEncoding + }; + } + public IJsonResult Json(object value) { return new JsonResult(value); diff --git a/src/Microsoft.AspNet.Mvc.Core/Controller.cs b/src/Microsoft.AspNet.Mvc.Core/Controller.cs index a43e2e2655..14584a8afe 100644 --- a/src/Microsoft.AspNet.Mvc.Core/Controller.cs +++ b/src/Microsoft.AspNet.Mvc.Core/Controller.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNet.Abstractions; +using System.Text; +using Microsoft.AspNet.Abstractions; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.Mvc.Rendering; @@ -76,5 +77,25 @@ namespace Microsoft.AspNet.Mvc return Result.View(view, ViewData); } + + public IActionResult Content(string content) + { + return Content(content, contentType: null); + } + + public IActionResult Content(string content, string contentType) + { + return Content(content, contentType, contentEncoding: null); + } + + public IActionResult Content(string content, string contentType, Encoding contentEncoding) + { + return Result.Content(content, contentType, contentEncoding); + } + + public IJsonResult Json(object value) + { + return Result.Json(value); + } } } diff --git a/src/Microsoft.AspNet.Mvc.Core/IActionResultHelper.cs b/src/Microsoft.AspNet.Mvc.Core/IActionResultHelper.cs index 40dd5de1da..5785a789c0 100644 --- a/src/Microsoft.AspNet.Mvc.Core/IActionResultHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Core/IActionResultHelper.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNet.Mvc.Rendering; +using System.Text; +using Microsoft.AspNet.Mvc.Rendering; namespace Microsoft.AspNet.Mvc { @@ -6,6 +7,7 @@ namespace Microsoft.AspNet.Mvc { IActionResult Content(string value); IActionResult Content(string value, string contentType); + IActionResult Content(string value, string contentType, Encoding contentEncoding); IJsonResult Json(object value); IActionResult View(string view, ViewDataDictionary viewData); }