Exemplo n.º 1
0
 public static void RenderView(string viewPath, object model, TextWriter writer, ControllerContext controllerContext, out string errorMessage)
 {
     errorMessage = null;
     try
     {
         var renderer = new RazorViewRenderer(controllerContext);
         renderer.RenderView(viewPath, model, writer);
     }
     catch (Exception ex)
     {
         errorMessage = ex.GetBaseException().Message;
     }
 }
Exemplo n.º 2
0
 public static string RenderView(string viewPath, object model, ControllerContext controllerContext, out string errorMessage)
 {
     errorMessage = null;
     try
     {
         var renderer = new RazorViewRenderer(controllerContext);
         return(renderer.RenderViewToString(viewPath, model));
     }
     catch (Exception ex)
     {
         errorMessage = ex.GetBaseException().Message;
     }
     return(null);
 }
Exemplo n.º 3
0
        public static void RenderPartialView(string viewPath, TextWriter writer, object model = null, ControllerContext controllerContext = null)
        {
            var renderer = new RazorViewRenderer(controllerContext);

            renderer.RenderPartialView(viewPath, model, writer);
        }
Exemplo n.º 4
0
        public static string RenderPartialView(string viewPath, object model = null, ControllerContext controllerContext = null)
        {
            var renderer = new RazorViewRenderer(controllerContext);

            return(renderer.RenderPartialViewToString(viewPath, model));
        }