Esempio n. 1
0
        public static string RenderView(this DirectControllerAction controllerAction, IView view)
        {
            var stringWriter = new StringWriter();

            controllerAction.RenderView(view, stringWriter);
            return(stringWriter.ToString());
        }
Esempio n. 2
0
        public static string RenderView(this DirectControllerAction controllerAction, string viewName, string masterName)
        {
            var stringWriter = new StringWriter();

            controllerAction.RenderView(viewName, masterName, stringWriter);
            return(stringWriter.ToString());
        }
Esempio n. 3
0
        public static string RenderView(this DirectControllerAction controllerAction, Stream contentStream)
        {
            var stringWriter = new StringWriter();

            controllerAction.RenderView(contentStream, stringWriter);
            return(stringWriter.ToString());
        }
Esempio n. 4
0
        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);
        }