public ActionResult Save() { // For the save we'll be dumping all the text from the text area // into a text file in the root file system. // Get the department from the form data string dept = Request.Form["slctDepartment"]; if (string.IsNullOrEmpty(dept)) { throw new Exception( "Was expecting a valid department from the form data but instead " + "got a null or empty string. Make sure that the department list " + "file does not have blank lines."); } // Get the list of ABET options from the form data string opts = Request.Form["taOptions"]; if (null == opts) { // Empty strings are OK, null strings are not throw new Exception("Form data missing \"taOptions\"."); } // Write the file OSBLE.Models.FileSystem.OSBLEDirectory fs = Models.FileSystem.Directories.GetAdmin(); fs.AddFile(dept + "_abet_outcomes.txt", System.Text.Encoding.UTF8.GetBytes(opts)); // Go back to the main admin page return(RedirectToAction("Index", "Admin")); }
public ActionResult Save() { // Get the list of departments from the form data string allDepts = Request.Form["taDepts"]; if (null != allDepts) { OSBLE.Models.FileSystem.OSBLEDirectory fs = Models.FileSystem.Directories.GetAdmin(); fs.AddFile("departments.txt", System.Text.Encoding.UTF8.GetBytes(allDepts)); } return(RedirectToAction("Index", "Admin")); }