public IActionResult OnGet(int courseId) { Course = _courseData.GetById(courseId); if (Course == null) { return(RedirectToPage("./NotFound")); } return(Page()); }
public IActionResult OnGet(int?courseId) { if (courseId.HasValue) { Course = _courseData.GetById(courseId.Value); } else { Course = new Course { Teacher = new Teacher() }; } if (Course == null) { return(RedirectToPage("./NotFound")); } return(Page()); }