public static string RenderView(this DirectControllerAction controllerAction, IView view) { var stringWriter = new StringWriter(); controllerAction.RenderView(view, stringWriter); return(stringWriter.ToString()); }
public static string RenderView(this DirectControllerAction controllerAction, string viewName, string masterName) { var stringWriter = new StringWriter(); controllerAction.RenderView(viewName, masterName, stringWriter); return(stringWriter.ToString()); }
public static string RenderView(this DirectControllerAction controllerAction, Stream contentStream) { var stringWriter = new StringWriter(); controllerAction.RenderView(contentStream, stringWriter); return(stringWriter.ToString()); }
public static void RenderView(this DirectControllerAction controllerAction, Stream contentStream, TextWriter writer) { var actionName = controllerAction.ActionDescriptor.ActionName; var controllerName = controllerAction.ActionDescriptor.ControllerDescriptor.ControllerName; var virtualPath = string.Format("~/Views/{0}/{1}.cshtml", controllerName, actionName); var view = new RazorViewSimulator(controllerAction.MvcApplication, new StreamVirtualContent(virtualPath, contentStream)); controllerAction.RenderView(view, writer); }
public static void RenderView(this DirectControllerAction controllerAction, IView view, TextWriter writer) { var controllerContext = controllerAction.CreateControllerContext(); controllerContext.HttpContext.Response.Output = writer; var viewResult = new ViewResult { View = view, ViewEngineCollection = controllerAction.MvcApplication.ViewEngines }; viewResult.ExecuteResult(controllerContext); }
public static ViewResultSimulator <TModel> View <TModel>(this DirectControllerAction controllerAction, ActionExecutionContext executionContext, IVirtualContent virtualContent, TModel model) { return(new ViewResultSimulator <TModel>(executionContext, virtualContent, model)); }
public static ViewResultSimulator <object> View(this DirectControllerAction controllerAction, IVirtualContent virtualContent) { return(new ViewResultSimulator <object>(controllerAction.GetExecutionContext(), virtualContent, null)); }