Small tweaks.

This commit is contained in:
David Fowler 2013-12-14 15:51:32 -08:00
parent 307d2ea198
commit e87e819b14
4 changed files with 15 additions and 5 deletions

View File

@ -23,7 +23,11 @@ namespace Microsoft.AspNet.Mvc
public IActionResult Json(object value)
{
// TODO: Make this work at some point
throw new NotImplementedException();
}
public IActionResult View()
{
throw new NotImplementedException();
}
}

View File

@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Mvc
throw new InvalidOperationException(String.Format("Couldn't find controller '{0}'.", _descriptor.ControllerName));
}
Initialize(controller, _requestContext);
Initialize(controller);
var method = controller.GetType().GetMethod(_descriptor.ActionName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
@ -52,7 +52,7 @@ namespace Microsoft.AspNet.Mvc
return actionResult.ExecuteResultAsync(_requestContext);
}
private void Initialize(object controller, RequestContext requestContext)
private void Initialize(object controller)
{
var controllerType = controller.GetType();
@ -62,11 +62,11 @@ namespace Microsoft.AspNet.Mvc
{
if (prop.PropertyType == typeof(IOwinContext))
{
prop.SetValue(controller, requestContext.HttpContext);
prop.SetValue(controller, _requestContext.HttpContext);
}
else if (prop.PropertyType == typeof(IDictionary<string, object>))
{
prop.SetValue(controller, requestContext.HttpContext.Environment);
prop.SetValue(controller, _requestContext.HttpContext.Environment);
}
}
}

View File

@ -6,5 +6,6 @@ namespace Microsoft.AspNet.Mvc
IActionResult Content(string value);
IActionResult Content(string value, string contentType);
IActionResult Json(object value);
IActionResult View();
}
}

View File

@ -36,5 +36,10 @@ namespace MvcSample
return responseMessage;
}
public IActionResult MyView()
{
return Result.View();
}
}
}