public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } Dictionary <int, Hole> holes = new Dictionary <int, Hole>(); CurrentCourse.Holes = holes; courses.AddCourse(CurrentCourse); return(RedirectToPage("GetAllCourses")); }
async Task Save() { if (String.IsNullOrWhiteSpace(Courses.courseID) && String.IsNullOrWhiteSpace(Courses.staffID) && String.IsNullOrWhiteSpace(Courses.courseName)) { await _pageService.DisplayAlert("Error", "Please enter the ID and Name.", "OK"); return; } if (Courses.id == 0) { await _coursesStore.AddCourse(Courses); CourseAdded?.Invoke(this, Courses); } else { await _coursesStore.UpdateCourse(Courses); CourseUpdated?.Invoke(this, Courses); } await _pageService.PopModalAsync(); }