using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using Snootalogue.Data; using Snootalogue.Models; namespace Snootalogue.Pages.Documents { public class DetailsModel : PageModel { private readonly SnootalogueContext _context; public Document Document { get; set; } public DetailsModel(SnootalogueContext context) { _context = context; } public async Task OnGetAsync(int? id) { if (id == null) { return NotFound(); } Document = await _context.Document.FirstOrDefaultAsync(d => d.ID == id); if (Document == null) { return NotFound(); } return Page(); } } }