2024-02-26 02:50:48 +00:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
2024-03-02 00:43:56 +00:00
|
|
|
using OliverBooth.Common.Data.Web.Users;
|
|
|
|
using OliverBooth.Common.Services;
|
2024-02-26 02:50:48 +00:00
|
|
|
|
|
|
|
namespace OliverBooth.Pages.Admin;
|
|
|
|
|
|
|
|
public class BlogPosts : PageModel
|
|
|
|
{
|
|
|
|
private readonly ISessionService _sessionService;
|
|
|
|
|
|
|
|
public BlogPosts(ISessionService sessionService)
|
|
|
|
{
|
|
|
|
_sessionService = sessionService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public IUser CurrentUser { get; private set; } = null!;
|
|
|
|
|
|
|
|
public IActionResult OnGet()
|
|
|
|
{
|
|
|
|
if (!_sessionService.TryGetCurrentUser(Request, Response, out IUser? user))
|
|
|
|
{
|
|
|
|
return RedirectToPage("/admin/login");
|
|
|
|
}
|
|
|
|
|
|
|
|
CurrentUser = user;
|
|
|
|
return Page();
|
|
|
|
}
|
|
|
|
}
|