/// <summary> /// Executes the specified action against /// the current context and captures an output string. /// </summary> /// <param name="block">The action to execute</param> /// <param name="arg1">The first argument of the action.</param> /// <param name="arg2">The second argument of the action.</param> /// <param name="arg3">The third argument of the action.</param> public string Block <T1, T2, T3>(Action <T1, T2, T3> block, T1 arg1, T2 arg2, T3 arg3) { BlockRenderer br = new BlockRenderer(_context.Context); return(br.Capture(() => block(arg1, arg2, arg3))); }
/// <summary> /// Executes the specified action against /// the current context and captures an output string. /// </summary> /// <param name="block">The action to execute</param> public string Block(Action block) { BlockRenderer br = new BlockRenderer(_context.Context); return(br.Capture(block)); }
/// <summary> /// Executes the specified action against /// the current context and captures an output string. /// </summary> /// <param name="block">The action to execute</param> /// <param name="parameter">The parameter for the action.</param> public string Block <T>(Action <T> block, T parameter) { BlockRenderer br = new BlockRenderer(_context.Context); return(br.Capture(() => block(parameter))); }
private static string RenderToString(ViewResult result, ControllerContext controllerContext) { StringWriter writer = new StringWriter(); ViewContext viewContext = new ViewContext(controllerContext, new WebFormView(controllerContext, "omg"), result.ViewData, result.TempData, writer); var blockRenderer = new BlockRenderer(controllerContext.HttpContext); result.ExecuteResult(controllerContext); //HtmlHelper h = new HtmlHelper(new ViewContext(controllerContext, new WebFormView("omg"), result.ViewData, result.TempData, ), new ViewPage()); //var blockRenderer = new BlockRenderer(controllerthis.db.HttpContext); //result.ExecuteResult(controllerContext); string s = blockRenderer.Capture( () => result.ExecuteResult(controllerContext) ); return(s); }