32 lines
711 B
C#
32 lines
711 B
C#
|
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();
|
||
|
}
|
||
|
}
|
||
|
}
|