Example #1
0
        /// <summary>
        /// Renders the view.
        /// </summary>
        /// <returns>The view.</returns>
        /// <param name="viewPath">View path.</param>
        /// <param name="model">Model.</param>
        /// <param name="controllerContext">Controller context.</param>
        public static string RenderView(string viewPath, object model,
                                        ControllerContext controllerContext)
        {
            RenderRazor renderer = new RenderRazor(controllerContext);

            return(renderer.RenderView(viewPath, model));
        }
Example #2
0
 /// <summary>
 /// Renders the view.
 /// </summary>
 /// <returns>The view.</returns>
 /// <param name="viewPath">View path.</param>
 /// <param name="model">Model.</param>
 /// <param name="controllerContext">Controller context.</param>
 /// <param name="errorMessage">Error message.</param>
 public static string RenderView(string viewPath, object model,
                                 ControllerContext controllerContext,
                                 out string errorMessage)
 {
     errorMessage = null;
     try
     {
         RenderRazor renderer = new RenderRazor(controllerContext);
         return(renderer.RenderView(viewPath, model));
     }
     catch (Exception ex)
     {
         errorMessage = ex.GetBaseException().Message;
     }
     return(null);
 }