public async Task <ActionResult> OnPost() { if (!ModelState.IsValid) { return(Page()); } if (Course.Id == 0) { var result = await coursesProvider.AddSync(Course); if (result.IsSuccess) { return(RedirectToPage("Courses")); } return(Page()); } else { var result = await coursesProvider.UpdateAsync(Course.Id, Course); if (result) { return(RedirectToPage("Courses")); } } return(Page()); }