Snootalogue/Pages/Documents/Details.cshtml.cs

32 lines
711 B
C#
Raw Normal View History

2020-09-16 02:14:31 +00:00
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<IActionResult> OnGetAsync(int? id) {
if (id == null) {
return NotFound();
}
Document = await _context.Document.FirstOrDefaultAsync(d => d.ID == id);
if (Document == null) {
return NotFound();
}
return Page();
}
}
}