38 lines
1.1 KiB
C#

using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace EnotaryoPH.Web.Pages
{
public class IndexModel : PageModel
{
private readonly ICurrentUserService _currentUserService;
private readonly NotificationService _notificationService;
public IndexModel(ICurrentUserService currentUserService, NotificationService notificationService)
{
_currentUserService = currentUserService;
_notificationService = notificationService;
}
public IActionResult OnGet()
{
if (_currentUserService.IsAuthenticated() == false)
{
return Page();
}
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();
}
}
}