public IActionResult CompileAndBuild( SourceCodeFilesViewModel sourceCodeFilesVM ) { ViewBag.SelectedOsType = _osTypeList[_selectedOsIndex - 1].Name; // SourceCodeFilesViewModel sourceCodeFilesVM = // (SourceCodeFilesViewModel)TempData["UploadedSourceCodeList"]; return(View(sourceCodeFilesVM)); }
public async Task <IActionResult> UploadSources( List <IFormFile> SourceCodeFiles) { List <SourceCodeFile> uploadedSourceCodeFileList = new List <SourceCodeFile>(); long size = SourceCodeFiles.Sum(f => f.Length); // full path to file in temp location var filePath = Path.GetTempFileName(); foreach (var formFile in SourceCodeFiles) { if (formFile.Length > 0) { uploadedSourceCodeFileList.Add( new SourceCodeFile() { FileName = formFile.FileName, FilePath = filePath } ); using (var stream = new FileStream( filePath, FileMode.Create)) { await formFile.CopyToAsync(stream); } } } if (size > 0) { SourceCodeFilesViewModel sourceCodeVM = new SourceCodeFilesViewModel( uploadedSourceCodeFileList ); return(View( "CompileAndBuild", sourceCodeVM)); // TempData["UploadedSourceCodeList"] = sourceCodeVM; // return RedirectToAction( // "CompileAndBuild" // // , new SourceCodeFilesViewModel(){ // // SourceCodeFileList = uploadedSourceCodeFileList} // ); // return View("CompileAndBuild"); } else { TempData["ErrorUploadSourceMessage"] = "Please select at least one file before press Upload button!"; // return View( // "UploadSources", // new { SelectedOsIndex = _selectedOsIndex }); return(RedirectToAction( "UploadSources")); } }