public override void ExecuteResult(ControllerContext context) { ProductXmlDataEngine xmlEngine = new ProductXmlDataEngine(); TabType tabType = xmlEngine.GetTabType(this.FileName); string content = xmlEngine.GetTabContent(tabType, this.FileName); context.HttpContext.Response.Output.Write(content); }
public static string RenderSourceCodeTab(this System.Web.Mvc.HtmlHelper helper, string controlid) { ProductXmlDataEngine xmlEngine = new ProductXmlDataEngine(); HtmlTag wrapperDiv = new HtmlTag("div").Id(controlid); UrlHelper urlHelper = new UrlHelper(helper.ViewContext.RequestContext); string sourcecodetabUrl = urlHelper.Action("Index", "SourceCodeTab"); wrapperDiv.Modify(w => { HtmlTag UlElement = new HtmlTag("ul", el => { el.Add(new HtmlTag("li", x => { string filePath = xmlEngine.GetSourceTabUrl(helper, TabType.View); x.Add("a").Text("View").Attributes().Add("href", sourcecodetabUrl + "?file=" + filePath); })); el.Add(new HtmlTag("li", x => { string filePath = xmlEngine.GetSourceTabUrl(helper, TabType.CS); x.Add("a").Text("Controller").Attributes().Add("href", sourcecodetabUrl + "?file=" + filePath); })); IEnumerable <XElement> otherFiles = xmlEngine.GetSourceCodeOtherFiles(helper); if (otherFiles != null) { otherFiles.ForEach(c => { el.Add(new HtmlTag("li", x => { x.Add(new HtmlTag("a").Text(c.Attribute("displayname").Value).Attributes("href", sourcecodetabUrl + "?file=" + c.Attribute("url").Value)); })); }); } }); w.Add(UlElement); }); string scriptTag = "<script>$('#" + controlid + "').ejTab();</script>"; return(wrapperDiv.ToString() + scriptTag); }