using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace OliverBooth.Pages.Blog;
///
/// Represents a class which defines the model for the /blog/page/# route.
///
public class List : PageModel
{
///
/// Gets the requested page number.
///
/// The requested page number.
public int PageNumber { get; private set; }
///
/// Handles the incoming GET request to the page.
///
/// The requested page number, starting from 1.
///
public IActionResult OnGet([FromRoute(Name = "pageNumber")] int page = 1)
{
if (page < 2)
{
return RedirectToPage("Index");
}
PageNumber = page;
return Page();
}
}