public IActionResult OnGet(int id) { Clinic = clinicData.GetClinicById(id); if (Clinic == null) { return(RedirectToPage("~/NotFound")); } return(Page()); }
public IActionResult OnGet(int?id) { if (id.HasValue) { Clinic = clinicData.GetClinicById(id.Value); if (Clinic == null) { return(RedirectToPage("~/NotFound")); } } else { Clinic = new Core.Clinic(); } return(Page()); }
public IActionResult OnPost() { if (ModelState.IsValid) { if (Clinic.Id == 0) { Clinic = clinicData.Create(Clinic); TempData["TempMessage"] = "New clinic is created!"; } else { Clinic = clinicData.Update(Clinic); TempData["TempMessage"] = "Clinic details are updated"; } clinicData.Commit(); return(RedirectToPage("./List")); } return(Page()); }