/// <summary> /// Renders the view using the specified control. /// </summary> /// <param name="controller">The controller.</param> /// <param name="masterPage">The master page.</param> /// <param name="templateName">Name of the template.</param> /// <param name="control">The control.</param> /// <returns></returns> public static ActionResult TemplateView( this Controller controller, string masterPage, string templateName, Control control ) { TemplateResult result = new TemplateResult(); result.MasterPageFile = masterPage; result.AddControl( templateName, control ); return result; }
/// <summary> /// Executes the specified request context. /// </summary> /// <returns></returns> public ActionResult Default( ) { string virtualPath = ControllerContext.RouteData.GetRequiredString( "VirtualPath" ); string templateName = ControllerContext.RouteData.GetRequiredString( "TemplateName" ); string masterPage = ControllerContext.RouteData.GetRequiredString( "MasterPageFile" ); object theme; ControllerContext.RouteData.DataTokens.TryGetValue( "Theme", out theme ); TemplateResult result = new TemplateResult(); result.MasterPageFile = masterPage; result.Theme = ( theme == null ) ? string.Empty : ( string )theme; result.AddControl( templateName, virtualPath ); return result; }