Beispiel #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;
     }
 }
Beispiel #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);
 }
Beispiel #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);
        }
Beispiel #4
0
        public static string RenderPartialView(string viewPath, object model = null, ControllerContext controllerContext = null)
        {
            var renderer = new RazorViewRenderer(controllerContext);

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