summaryrefslogtreecommitdiff
path: root/Pages/ViewMedia.cshtml.cs
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-08-08 13:20:21 +1000
committerJake Mannens <jake@asger.xyz>2023-08-08 13:20:21 +1000
commit701d474949e5cb72b8ed7b29fec45ad74580f570 (patch)
tree0eea7adfdd9d7dde4dd44535cd172d7e6a4f8737 /Pages/ViewMedia.cshtml.cs
Initial commit
Diffstat (limited to 'Pages/ViewMedia.cshtml.cs')
-rw-r--r--Pages/ViewMedia.cshtml.cs23
1 files changed, 23 insertions, 0 deletions
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