summaryrefslogtreecommitdiff
path: root/Pages/ViewMedia.cshtml.cs
diff options
context:
space:
mode:
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