Пример #1
0
        public IActionResult OnPostAsync(int id)
        {
            TeamCollection teamCollection = new TeamCollection();

            try
            {
                DisplayTeam = teamCollection.ReadTeam(id);
                teamCollection.DeleteTeam(DisplayTeam);
            }
            catch (MySqlException e)
            {
                var code = e.ErrorCode;
                if (code == -2147467259)
                {
                    return(RedirectToPage("/DatabaseConnectionError"));
                }
                else
                {
                    return(RedirectToPage("/Error"));
                }
            }
            finally
            {
                DisplayTeam = teamCollection.ReadTeam(id);
            }
            return(RedirectToPage("/Team"));
        }
Пример #2
0
        public void OnGet(int id)
        {
            TeamCollection teamCollection = new TeamCollection();

            DisplayTeam = teamCollection.ReadTeam(id);
        }