auto.bus_razor/TicketOffice/Pages/Management/Index.cshtml.cs

27 lines
618 B
C#

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using TicketOffice.Services;
namespace TicketOffice.Pages.Management;
public class Index : PageModel
{
private readonly UserValidationService validationService;
public Index(UserValidationService validationService)
{
this.validationService = validationService;
}
public ActionResult OnGet()
{
if (!validationService.IsAuthorized(HttpContext))
{
return RedirectToPage("/Index");
}
else
{
return RedirectToPage("./Routes");
}
}
}