From 6c53f3dc43f072dce4ffe4a1bd306074dd20ff39 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Sun, 17 Aug 2025 22:10:27 +1000 Subject: Initial commit --- Pages/ViewMedia.cshtml.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Pages/ViewMedia.cshtml.cs (limited to 'Pages/ViewMedia.cshtml.cs') diff --git a/Pages/ViewMedia.cshtml.cs b/Pages/ViewMedia.cshtml.cs new file mode 100644 index 0000000..fe8d150 --- /dev/null +++ b/Pages/ViewMedia.cshtml.cs @@ -0,0 +1,23 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace HyperBooru.Pages; + +public class ViewMediaModel : PageModel { + public DbMedia Media { get; private set; } + + private HyperBooruDbContext db; + + public ViewMediaModel(HyperBooruDbContext db) => + this.db = db; + + public IActionResult OnGet([FromQuery(Name = "m")] Guid mediaId) { + var media = db.Media.First(m => m.Guid == mediaId); + if(media is null) + return NotFound(); + + Media = media; + + return Page(); + } +} \ No newline at end of file -- cgit v1.3