BlogService now fetches from Media.JoshHeaps.Net API via HttpClient with in-memory caching (5-min TTL) and stale cache fallback. Removed Markdig/YamlDotNet dependencies. All page models now async. Co-Authored-By: Claude Opus 4.6 <[email protected]>
29 lines
622 B
C#
29 lines
622 B
C#
using JoshHeaps.Net.Models;
|
|
using JoshHeaps.Net.Services.Interfaces;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
|
namespace JoshHeaps.Net.Pages.Blog;
|
|
|
|
public class PostModel : PageModel
|
|
{
|
|
private readonly IBlogService _blogService;
|
|
|
|
public BlogPost? Post { get; set; }
|
|
|
|
public PostModel(IBlogService blogService)
|
|
{
|
|
_blogService = blogService;
|
|
}
|
|
|
|
public async Task<IActionResult> OnGetAsync(string slug)
|
|
{
|
|
Post = await _blogService.GetPostBySlugAsync(slug);
|
|
|
|
if (Post is null)
|
|
return NotFound();
|
|
|
|
return Page();
|
|
}
|
|
}
|