diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-05-12 10:16:49 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-05-12 10:16:49 +0300 |
| commit | ca965d536278a4970ede0b88a92c6f218bfc5915 (patch) | |
| tree | a49bf0a2080414ece920914dd14bbbd1f1d03c08 /ExamTemplate/Web/Controllers | |
| parent | 5436337b45e98b6001bbae0c6d36fe004ff1e55c (diff) | |
| download | it-kariera-exam-template-ca965d536278a4970ede0b88a92c6f218bfc5915.tar it-kariera-exam-template-ca965d536278a4970ede0b88a92c6f218bfc5915.tar.gz it-kariera-exam-template-ca965d536278a4970ede0b88a92c6f218bfc5915.zip | |
Implemented a 404 not found page
Diffstat (limited to 'ExamTemplate/Web/Controllers')
| -rw-r--r-- | ExamTemplate/Web/Controllers/AccountController.cs | 6 | ||||
| -rw-r--r-- | ExamTemplate/Web/Controllers/HomeController.cs | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/ExamTemplate/Web/Controllers/AccountController.cs b/ExamTemplate/Web/Controllers/AccountController.cs index f970a2c..a7ad771 100644 --- a/ExamTemplate/Web/Controllers/AccountController.cs +++ b/ExamTemplate/Web/Controllers/AccountController.cs @@ -39,7 +39,7 @@ namespace ExamTemplate.Web.Controllers bool result = await this._userService.RegisterUserAsync(registerUserServiceModel); if (result) - return await Login(new LoginUserViewModel { + return await this.Login(new LoginUserViewModel { Username = registerUserServiceModel.Username, Password = registerUserServiceModel.Password }); @@ -86,7 +86,7 @@ namespace ExamTemplate.Web.Controllers UserServiceModel userServiceModel = await this._userService.GetUserByUsernameAsync(username); if (userServiceModel == default(UserServiceModel)) - return RedirectToAction("Login"); + return RedirectToAction("ErrorNotFound", "Home"); UserViewModel userViewModel = this._autoMapper.Map<UserViewModel>(userServiceModel); @@ -99,7 +99,7 @@ namespace ExamTemplate.Web.Controllers UserServiceModel userServiceModel = await this._userService.GetUserByClaimsAsync(this.HttpContext.User); if (userServiceModel == default(UserServiceModel)) - return RedirectToAction("Login"); + return RedirectToAction("ErrorNotFound", "Home"); EditUserViewModel editUserViewModel = this._autoMapper.Map<EditUserViewModel>(userServiceModel); diff --git a/ExamTemplate/Web/Controllers/HomeController.cs b/ExamTemplate/Web/Controllers/HomeController.cs index f35cb1e..d9cfc45 100644 --- a/ExamTemplate/Web/Controllers/HomeController.cs +++ b/ExamTemplate/Web/Controllers/HomeController.cs @@ -24,5 +24,10 @@ namespace ExamTemplate.Web.Controllers {
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
+
+ public IActionResult ErrorNotFound()
+ {
+ return View();
+ }
}
}
|
