Пример #1
0
        public virtual string Include(string template, string key = null, string value = null)
        {
            var           templateContent = SiteBuilder.Razor.GetTemplate("~/" + template + ".cshtml");
            BetterExpando viewbag;

            if (key != null && value != null)
            {
                viewbag = new BetterExpando();
                ((dynamic)viewbag)[key] = value;
                viewbag.Augment(this.ViewBag);
            }
            else
            {
                viewbag = this.ViewBag;
            }
            // Render the page at the template
            ITemplate output = SiteBuilder.Razor.Execute(templateContent, this.Model, viewbag: viewbag);

            return(output.Result);
        }