public async Task <IActionResult> OnPostWhen() { try { string cs = _config.GetConnectionString("Default"); if (!fd.WhenDupeCheck(cs, Request.Form["NewWhen.WhenText"].ToString())) { fd.AddWhen(cs, Request.Form["NewWhen.WhenText"].ToString()); return(RedirectToPage("./Index")); } return(RedirectToPage("./Index", new { @redirect = "Whendupe", @value = Request.Form["NewWhen.WhenText"].ToString() })); } catch (Exception ex) { throw new Exception(ex.ToString()); } }