using System.Data.Entity; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using ZpcBulletinBoard.Data; namespace ZpcBulletinBoard.Pages.Editor { [Authorize] public class EditMainModel(ILogger logger, ApplicationDbContext context) : PageModel { private readonly ILogger _logger = logger; public void OnGet() { } public IActionResult OnGetBoards() { var boards= context.BulletinBoards.ToList(); return new JsonResult(new { successful = true, error = $"", boards }); } public IActionResult OnGetBoard(int id) { var board = context.BulletinBoards.Include(x => x.Pages) .FirstOrDefault(x => x.IdBulletinBoard == id); return new JsonResult(new { successful = true, error = $"", board }); } } }