public IActionResult Index() { Server = getServerFromSession(); differences = getDifferencesFromSession(); ChangeRecordModel changeRecord = new ChangeRecordModel(); NewDSC = new VmW_AddNewServerDSCModel(Server, differences); return(View()); }
public IActionResult Submit(VmW_AddNewServerDSCModel _NewDSC) { JsonService = new JsonFileServices(); ChangeRecordModel changeRecord = new ChangeRecordModel(); changeRecord = _NewDSC.ChangeRecord; NewDSC = new VmW_AddNewServerDSCModel(); NewDSC.Server = getServerFromSession(); NewDSC.ChangeRecord = changeRecord; JsonService.SetNewServerDSC(NewDSC); NewDSC.ChangeRecord.ChangeNumber = ""; return(Redirect(nameof(Index))); }
public string SetNewServerDSC(VmW_AddNewServerDSCModel newDSC) { try { FileStream fs = File.Create(getCustomerDirectoryPath(newDSC.Server.Customer) + "\\Scheduled" + "\\" + newDSC.Server.ServerName + "_" + newDSC.ChangeRecord.ChangeNumber + "_" + SimpliFyDataHour(newDSC.ChangeRecord.StartDate_Hour) + "_" + SimpliFyDataHour(newDSC.ChangeRecord.EndData_Hour) + ".json"); fs.Close(); using (StreamWriter sw = new StreamWriter(fs.Name)) { sw.Write(newDSC.Server.ToString()); }; return(" A file name " + fs.Name + " was created with success."); } catch (System.Exception ex) { return(ex.Message); } }