public IActionResult OnPost() { var temp = hospitalService.DeleteHospital(Hospital.Id); if (temp == null) { return(RedirectToPage("NotFound")); } hospitalService.Commit(); TempData["Message"] = "Hospital Deleted!"; return(RedirectToPage("HospitalList")); }
public IActionResult OnPost() { if (ModelState.IsValid) { if (Hospital.Id == 0) { Hospital = hospitalService.CreateHospital(Hospital); } else { Hospital = hospitalService.UpdateHospital(Hospital); } hospitalService.Commit(); TempData["Message"] = "New Hospital Created!"; return(RedirectToPage("HospitalList")); } return(Page()); }