예제 #1
0
        public IActionResult OnPostAsync(int id)
        {
            PlayerCollection playerCollection = new PlayerCollection();

            try
            {
                DisplayPlayer = playerCollection.ReadPlayer(id);
                playerCollection.DeletePlayer(DisplayPlayer);
            }
            catch (MySqlException e)
            {
                var code = e.ErrorCode;
                if (code == -2147467259)
                {
                    return(RedirectToPage("/DatabaseConnectionError"));
                }
                else
                {
                    return(RedirectToPage("/Error"));
                }
            }
            return(RedirectToPage("/Players"));
        }