Exemplo n.º 1
0
        public async Task <IActionResult> OnGet()
        {
            if (_signIn.IsSignedIn(User))
            {
                var user = await _identity.GetUserAsync(User);

                var response = await _identity.DeleteAsync(user);

                if (response.Succeeded)
                {
                    var removedUser = await _user.GetUserByUserIdAsync(user.Id);

                    _ = await _user.DeleteUserAsync(removedUser.Id);

                    await _signIn.SignOutAsync();

                    return(RedirectToPage("/Index"));
                }

                TempData["Failed"] = "Sorry something went wrong, try again";
                return(RedirectToPage());
            }

            return(RedirectToPage("/Index"));
        }