Merge pull request #151 from sornaks/WebFX153
WebFX-153: Add Content() and Json() to the Controller class.
This commit is contained in:
commit
e8a76cfd7f
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc
|
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)
|
public IJsonResult Json(object value)
|
||||||
{
|
{
|
||||||
return new JsonResult(value);
|
return new JsonResult(value);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNet.Abstractions;
|
using System.Text;
|
||||||
|
using Microsoft.AspNet.Abstractions;
|
||||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
|
|
||||||
|
|
@ -76,5 +77,25 @@ namespace Microsoft.AspNet.Mvc
|
||||||
|
|
||||||
return Result.View(view, ViewData);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNet.Mvc.Rendering;
|
using System.Text;
|
||||||
|
using Microsoft.AspNet.Mvc.Rendering;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc
|
namespace Microsoft.AspNet.Mvc
|
||||||
{
|
{
|
||||||
|
|
@ -6,6 +7,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
{
|
{
|
||||||
IActionResult Content(string value);
|
IActionResult Content(string value);
|
||||||
IActionResult Content(string value, string contentType);
|
IActionResult Content(string value, string contentType);
|
||||||
|
IActionResult Content(string value, string contentType, Encoding contentEncoding);
|
||||||
IJsonResult Json(object value);
|
IJsonResult Json(object value);
|
||||||
IActionResult View(string view, ViewDataDictionary viewData);
|
IActionResult View(string view, ViewDataDictionary viewData);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue