diff --git a/EnotaryoPH/EnotaryoPH.Web/Pages/Index.cshtml.cs b/EnotaryoPH/EnotaryoPH.Web/Pages/Index.cshtml.cs index cc106ec..17a2547 100644 --- a/EnotaryoPH/EnotaryoPH.Web/Pages/Index.cshtml.cs +++ b/EnotaryoPH/EnotaryoPH.Web/Pages/Index.cshtml.cs @@ -1,3 +1,4 @@ +using System.Text.Json; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; @@ -6,8 +7,13 @@ namespace EnotaryoPH.Web.Pages public class IndexModel : PageModel { private readonly ICurrentUserService _currentUserService; + private readonly NotificationService _notificationService; - public IndexModel(ICurrentUserService currentUserService) => _currentUserService = currentUserService; + public IndexModel(ICurrentUserService currentUserService, NotificationService notificationService) + { + _currentUserService = currentUserService; + _notificationService = notificationService; + } public IActionResult OnGet() { @@ -16,10 +22,15 @@ namespace EnotaryoPH.Web.Pages return Page(); } - if (_currentUserService.GetRole() == "Principal") + var role = _currentUserService.GetRole(); + if (role == nameof(UserType.Principal)) { return RedirectToPage("/Principal/Dashboard/Dashboard"); } + else if (role == nameof(UserType.Notary)) + { + return RedirectToPage("/Notary/Dashboard/Dashboard"); + } return Page(); } diff --git a/EnotaryoPH/EnotaryoPH.Web/Pages/Login.cshtml.cs b/EnotaryoPH/EnotaryoPH.Web/Pages/Login.cshtml.cs index c6cc2b7..9474ae7 100644 --- a/EnotaryoPH/EnotaryoPH.Web/Pages/Login.cshtml.cs +++ b/EnotaryoPH/EnotaryoPH.Web/Pages/Login.cshtml.cs @@ -54,7 +54,7 @@ namespace EnotaryoPH.Web.Pages }); var returnUrl = Request.Query["ReturnUrl"].ToString() ?? string.Empty; - return RedirectToPage(string.IsNullOrEmpty(returnUrl) ? "/Principal/Dashboard/Dashboard" : returnUrl); + return Redirect(string.IsNullOrEmpty(returnUrl) ? "/" : returnUrl); } [Required]