コード例 #1
0
        public IActionResult OnPost(int doctorId)
        {
            var doctor = doctorData.Delete(doctorId);

            doctorData.Commit();

            if (doctor == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            TempData["Message"] = $"{doctor.Name} deleted";
            return(RedirectToPage("./List"));
        }
コード例 #2
0
        public IActionResult OnPost(int id)
        {
            var temp = doctorData.GetDoctorById(id);

            if (temp == null)
            {
                return(RedirectToPage("~/NotFound"));
            }
            var temp2 = doctorData.Delete(temp.Id);

            doctorData.Commit();
            TempData["TempMessage"] = "The doctor is fired!";
            return(RedirectToPage("./List"));
        }