//Updates the appointment. public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Appointment).State = EntityState.Modified; try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AppointmentExists(Appointment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
//Adds a centre to database. public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.MedicalCentre.Add(MedicalCentre); _context.SaveChanges(); return(RedirectToPage("./Index")); }
//Adds an appointment to database. public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Appointment.Add(Appointment); _context.SaveChanges(); return(RedirectToPage("./Index")); }
//Removes the patient information uses linq query to check presence. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Patient = (from patient in _context.Patient where patient.Id == id select patient).FirstOrDefault(); if (Patient != null) { _context.Patient.Remove(Patient); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Removes the doctor. uses a linq query to check the presence public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Doctor = (from doctor in _context.Doctor where doctor.Id == id select doctor).FirstOrDefault(); if (Doctor != null) { _context.Doctor.Remove(Doctor); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Removes a centre uses a linq query to check presence. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } MedicalCentre = (from centre in _context.MedicalCentre where centre.Id == id select centre ).FirstOrDefault(); if (MedicalCentre != null) { _context.MedicalCentre.Remove(MedicalCentre); _context.SaveChanges(); } return(RedirectToPage("./Index")); }