示例#1
0
        public IActionResult OnPost()
        {
            var temp = hospitalService.DeleteHospital(Hospital.Id);

            if (temp == null)
            {
                return(RedirectToPage("NotFound"));
            }

            hospitalService.Commit();
            TempData["Message"] = "Hospital Deleted!";
            return(RedirectToPage("HospitalList"));
        }
示例#2
0
        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());
        }