Using Razor together with ASP.NET Web API
- by Fredrik N
On the blog post “If Then, If Then, If Then, MVC” I found the following code example: [HttpGet]public ActionResult List()
{
var list = new[] { "John", "Pete", "Ben" };
if (Request.AcceptTypes.Contains("application/json")) {
return Json(list, JsonRequestBehavior.AllowGet);
}
if (Request.IsAjaxRequest()) [
…