using Microsoft.AspNetCore.Mvc.RazorPages; using OliverBooth.Common.Data.Web; using OliverBooth.Common.Services; namespace OliverBooth.Pages; public class Books : PageModel { private readonly IReadingListService _readingListService; public Books(IReadingListService readingListService) { _readingListService = readingListService; } /// /// Gets the books currently being read. /// /// The books currently being read. public IReadOnlyCollection CurrentlyReading { get; private set; } = ArraySegment.Empty; /// /// Gets the books that are planned to be read. /// /// The books that are planned to be read. public IReadOnlyCollection PlanToRead { get; private set; } = ArraySegment.Empty; /// /// Gets the books that have been read. /// /// The books that have been read. public IReadOnlyCollection Read { get; private set; } = ArraySegment.Empty; public void OnGet() { CurrentlyReading = _readingListService.GetBooks(BookState.Reading); PlanToRead = _readingListService.GetBooks(BookState.PlanToRead); Read = _readingListService.GetBooks(BookState.Read); } }