48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
|
namespace EnotaryoPH.Web.Pages
|
|
{
|
|
public class IndexModel : PageModel
|
|
{
|
|
private readonly ICurrentUserService _currentUserService;
|
|
private readonly INotificationService _notificationService;
|
|
private readonly IEventService _eventService;
|
|
|
|
public IndexModel(ICurrentUserService currentUserService, INotificationService notificationService, IEventService eventService)
|
|
{
|
|
_currentUserService = currentUserService;
|
|
_notificationService = notificationService;
|
|
_eventService = eventService;
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
public async Task<IActionResult> OnPostAsync()
|
|
{
|
|
var message = new { Message = "the quick brown fox jumps over the lazy dog." };
|
|
|
|
await _eventService.LogAsync(NotaryoEvent.TransactionApproved, new Guid("0195dfd2-9048-77f1-9d9d-974828cb3e68"));
|
|
//await _notificationService.NotifyUserAsync("admin@enotaryo.ph", JsonSerializer.Serialize(message));
|
|
return Redirect("/");
|
|
}
|
|
}
|
|
} |