public IActionResult OnPostAsync(Team team) { TeamCollection teamCollection = new TeamCollection(); try { teamCollection.CreateTeam(team); } catch (MySqlException e) { var code = e.ErrorCode; if (code == -2147467259) { return(RedirectToPage("/DatabaseConnectionError")); } else { return(RedirectToPage("/Error")); } } return(RedirectToPage("/Team")); }