31 lines
705 B
C#
31 lines
705 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 ViewModel : PageModel {
|
|
private readonly SnootalogueContext _context;
|
|
public Document Document { get; set; }
|
|
|
|
public ViewModel(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();
|
|
}
|
|
}
|
|
}
|