//[Route("{cName}")] public IActionResult TemplateDetails([FromQuery] String cName) { ViewData["cFileName"] = cName; CompositeModel composeFileDetails = ComposerNew.GetSingleCompositeDetail(cName, true); String basePath = Path.Combine(Program.ComposeTemplateDir, cName); String contents = System.IO.File.ReadAllText(basePath); String[] parameters = ComposerNew.ExtractParameters(contents); ViewData["params"] = parameters; return(View(composeFileDetails)); }
public async Task <IActionResult> UploadFiles(IEnumerable <IFormFile> file, IFormCollection form) { //full path to file in temp location //var filePath = Path.GetTempFileName(); //foreach (var formFile in file) //{ // if (formFile.Length > 0) // { // using (var stream = new FileStream(filePath, FileMode.Create)) // { // await formFile.CopyToAsync(stream); // } // } //} String filePath = await ComposerNew.FilePathAsync(file); StringValues filename, cFileName; bool result = false; string contents = System.IO.File.ReadAllText(filePath); form.TryGetValue("destFileName", out filename); form.TryGetValue("file", out cFileName); String[] parameters = ComposerNew.ExtractParameters(contents, out result); if (result == false) { return(View("AddParameters")); } try { System.IO.File.WriteAllText(Path.Combine(Program.ComposeTemporaryDir, filename + ".yml"), contents); } catch (Exception e) { Debug.WriteLine(e.Message); } ViewData["fileString"] = contents; ViewData["FileName"] = filename; //ViewData["templateName"] = cFileName; return(View("AddParameters", parameters)); }