Ejemplo n.º 1
0
        public ActionResult CodeViewer(string name)
        {
            CodeViewerVM codeViewerVM = new CodeViewerVM();

            codeViewerVM = Helper.GetCodesByName(this, name);

            return(PartialView("_CodePreview", codeViewerVM));
        }
Ejemplo n.º 2
0
        public static CodeViewerVM GetCodesByName(this Controller controller, string ExampleFolderName)
        {
            Path.GetFullPath("~/Codes/csharp/");
            string physicalPath = controller.HttpContext.Request.MapPath(@"~\Codes\");

            var csharp = File.ReadAllText(string.Format(@"{0}\{1}\csharp.txt", physicalPath, ExampleFolderName));
            var html   = File.ReadAllText(string.Format(@"{0}\{1}\html.txt", physicalPath, ExampleFolderName));
            var js     = File.ReadAllText(string.Format(@"{0}\{1}\js.txt", physicalPath, ExampleFolderName));

            CodeViewerVM codeViewerVM = new CodeViewerVM()
            {
                CSharpCode = csharp,
                HTMLCode   = html,
                JSCode     = js
            };

            return(codeViewerVM);
        }