2022-11-26 17:17:38 +01:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
|
|
2022-12-02 04:19:01 +01:00
|
|
|
namespace zotanpw.Pages;
|
2022-11-26 17:17:38 +01:00
|
|
|
|
|
|
|
public class BlogPostModel : PageModel {
|
|
|
|
public BlogModel.BlogPost? Post;
|
|
|
|
|
|
|
|
public IActionResult OnGet() {
|
2022-12-02 04:19:01 +01:00
|
|
|
if (string.IsNullOrWhiteSpace((string)RouteData.Values["post"]!))
|
2022-11-26 17:17:38 +01:00
|
|
|
return NotFound();
|
|
|
|
|
|
|
|
Post = BlogModel.Posts.FirstOrDefault(p => p.Shorthand == (string)RouteData.Values["post"]!);
|
2022-12-02 04:19:01 +01:00
|
|
|
if (Post == null)
|
2022-11-26 17:17:38 +01:00
|
|
|
return NotFound();
|
|
|
|
|
|
|
|
return Page();
|
|
|
|
}
|
|
|
|
}
|