public IActionResult OnPost(int id) { var temp = appointmentData.GetAppointmentById(id); if (temp == null) { return(RedirectToPage("~/NotFound")); } var temp2 = appointmentData.Delete(temp.Id); appointmentData.Commit(); TempData["TempMessage"] = "The appointment is deleted!"; return(RedirectToPage("./List")); }