public async Task <IActionResult> OnPostFoodType() { try { string cs = _config.GetConnectionString("Default"); if (!fd.FoodTypeDupeCheck(cs, Request.Form["NewFoodType.FoodTypeText"].ToString())) { fd.AddFoodType(cs, Request.Form["NewFoodType.FoodTypeText"].ToString()); return(RedirectToPage("./Index")); } return(RedirectToPage("./Index", new { @redirect = "FoodTypedupe", @value = Request.Form["NewFoodType.FoodTypeText"].ToString() })); } catch (Exception ex) { throw new Exception(ex.ToString()); } }