diff options
Diffstat (limited to 'ExamTemplate/Web/Controllers/AccountController.cs')
| -rw-r--r-- | ExamTemplate/Web/Controllers/AccountController.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ExamTemplate/Web/Controllers/AccountController.cs b/ExamTemplate/Web/Controllers/AccountController.cs index d56d3df..373dd4b 100644 --- a/ExamTemplate/Web/Controllers/AccountController.cs +++ b/ExamTemplate/Web/Controllers/AccountController.cs @@ -131,10 +131,16 @@ namespace ExamTemplate.Web.Controllers return RedirectToAction("Profile", new { username = loggedInUser.Username }); } - // [HttpPost] - // public async Task<IActionResult> DeleteProfile(string username) - // { - // throw new System.NotImplementedException(); - // } + [HttpPost] + public async Task<IActionResult> Delete() + { + await this._userService.LogoutAsync(); + bool result = await this._userService.DeleteUserAsync(HttpContext.User); + + if (result) + return RedirectToAction("Login"); + else + return RedirectToAction("Index", "Home"); + } } } |
