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 SPWA.DataAccess.Data.Models;
using SPWA.Models;

namespace SPWA.Pages.Termn
{
    public class DetailsModel : PageModel
    {
        private readonly SPWA.Models.SPWAContext _context;

        public DetailsModel(SPWA.Models.SPWAContext context)
        {
            _context = context;
        }

        public Term Term { get; set; }

        public async Task<IActionResult> OnGetAsync(int? id)
        {
            if (id == null)
            {
                return NotFound();
            }

            Term = await _context.Term.FirstOrDefaultAsync(m => m.TermID == id);

            if (Term == null)
            {
                return NotFound();
            }
            return Page();
        }
    }
}
