public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email")] IssueReporter issueReporter) { if (id != issueReporter.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(issueReporter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IssueReporterExists(issueReporter.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(issueReporter)); }
public async Task <IActionResult> Create([Bind("Id,Name,Email")] IssueReporter issueReporter) { if (ModelState.IsValid) { _context.Add(issueReporter); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(issueReporter)); }
/// <summary> /// Adds the currently selected connection to the configuration so it is persisted /// </summary> /// <param name="configuration"></param> public bool UpdateConfigFromSelections(ConfigurationModel configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } // For first time / valid reconfigurations canSave will be enabled and hence config will be saved. Else only set the reporter. if (issueConfigurationControl != null && (issueConfigurationControl.CanSave || selectedIssueReporter.IsConfigured)) { configuration.SelectedIssueReporter = selectedIssueReporter.StableIdentifier; if (issueConfigurationControl.CanSave) { string serializedConfigs = configuration.IssueReporterSerializedConfigs; Dictionary <Guid, string> configs = new Dictionary <Guid, string>(); try { Dictionary <Guid, string> parsedConfigs = JsonConvert.DeserializeObject <Dictionary <Guid, string> >(serializedConfigs); configs = parsedConfigs ?? configs; } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) { e.ReportException(); } #pragma warning restore CA1031 // Do not catch general exception types string newConfigs = issueConfigurationControl.OnSave(); configs[selectedIssueReporter.StableIdentifier] = newConfigs; configuration.IssueReporterSerializedConfigs = JsonConvert.SerializeObject(configs); } IssueReporterManager.GetInstance().SetIssueReporter(selectedIssueReporter.StableIdentifier); IssueReporter.SetConfigurationPath(ConfigurationManager.GetDefaultInstance().SettingsProvider.ConfigurationFolderPath); issueConfigurationControl.OnDismiss(); return(true); } return(false); }
protected override void EndProcessing() { string history = "user opt-out"; string errors = "user opt-out"; if (IncludeCommandHistory.IsPresent) { var o = this.SessionState.InvokeCommand.InvokeScript("get-history | convertto-xml | select -expand outerxml").FirstOrDefault(); if (null == o) { history = "unable to retrieve history"; } else { history = o.ToString(); } } if (IncludeErrorHistory.IsPresent) { var o = this.SessionState.InvokeCommand.InvokeScript("$error | convertto-xml | select -expand outerxml").FirstOrDefault(); if (null == o) { errors = "unable to retrieve errors"; } else { errors = o.ToString(); } } var message = String.Format( "This issue was submitted via the Send-SeeShellIncident cmdlet.\nUser Notes: {0}", Message); IssueReporter.ReportIssue(errors, history, message); }
static void RunApplication(object o) { try { _keepApplicationAlive = true; _application = new Application(); var wait = o as ManualResetEvent; InitializeSeeShellApplication(); wait.Set(); _application.ShutdownMode = ShutdownMode.OnExplicitShutdown; _application.Run(); _application = null; } catch (Exception e) { var msg = "An unhandled exception has occurred in SeeShell on the main user interface thread."; Log.Error(msg, e); IssueReporter.ReportIssue(e.ToString(), null, msg); throw; } }