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

            Course = await _context.Courses
                     .Include(c => c.Department).SingleOrDefaultAsync(m => m.Id == id);

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

            Course = await _context.Courses.FindAsync(id);

            if (Course != null)
            {
                _context.Courses.Remove(Course);
                await _context.SaveChangesAsync();
            }

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

            Course = await _context.Courses
                     .Include(c => c.Department).SingleOrDefaultAsync(m => m.Id == id);

            if (Course == null)
            {
                return(NotFound());
            }
            ViewData["DepartmentId"] = new SelectList(_context.Departments, "Id", "Name");
            return(Page());
        }