diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-05-08 18:46:46 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-05-08 18:46:46 +0300 |
| commit | ead0edec370483e5e80d42cc49c67f13e28c13b1 (patch) | |
| tree | 37025a036c3ad8e6c6cc57315de88c3c003fdd0a /ExamTemplate/Web/Controllers | |
| parent | 0714b1c3091114d3089ea094e68d57d6a553066b (diff) | |
| download | it-kariera-exam-template-ead0edec370483e5e80d42cc49c67f13e28c13b1.tar it-kariera-exam-template-ead0edec370483e5e80d42cc49c67f13e28c13b1.tar.gz it-kariera-exam-template-ead0edec370483e5e80d42cc49c67f13e28c13b1.zip | |
Implemented account deletion
Diffstat (limited to 'ExamTemplate/Web/Controllers')
| -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"); + } } } |
