public IActionResult OnPost() { if (ModelState.IsValid) { var patient = patientData.GetPatientById(Appointment.PatientId); Appointment.Patient = patient; if (Appointment.Id == 0) { Appointment = appointmentData.Create(Appointment); TempData["TempMessage"] = "New appointment created!"; } else { Appointment = appointmentData.Update(Appointment); TempData["TempMessage"] = "Appointment is updated!"; } appointmentData.Commit(); return(RedirectToPage("./List")); } var patients = patientData.GetPatients().ToList().Select(p => new { Id = p.Id, Display = $"{p.FirstName} {p.LastName}" }); Patients = new SelectList(patients, "Id", "Display"); Symptom = htmlHelper.GetEnumSelectList <Symptom>(); return(Page()); }
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")); }
public IActionResult OnPost() { if (Appointment.AppointmentId > 0) { var appointmentStatus = Appointment.IsAvaiable; Appointment = appointmentData.GetById(Appointment.AppointmentId); Appointment.IsAvaiable = appointmentStatus; Appointment.UserName = this.User.Identity.Name; appointmentData.Update(Appointment); appointmentData.Commit(); } TempData["TempMessage"] = "Appointment Status Changed!"; return(RedirectToPage("./List")); }
public IActionResult OnPost() { if (!ModelState.IsValid) { Doctors = new SelectList(appointmentData.GetDoctors().Select(d => d.DoctorName)); Locations = new SelectList(appointmentData.GetLocations().Select(l => l.LocationName)); return(Page()); } if (Appointment.AppointmentId > 0) { appointmentData.Update(Appointment); } else { appointmentData.Add(Appointment); } appointmentData.Commit(); TempData["Message"] = "Appointment Saved!"; return(RedirectToPage("./Detail", new { appointmentId = Appointment.AppointmentId })); }
public IActionResult CreateAppointment(AppointmentDto appointmentDto) { if (appointmentDto == null) { return(BadRequest()); } var appointment = new Appointment(); appointment.Date = appointmentDto.Date; appointment.HasMedicalHistory = appointmentDto.HasMedicalHistory; appointment.IsCoronaPositive = appointmentDto.IsCoronaPositive; appointment.IsDead = appointmentDto.IsDead; appointment.IsForSelfIsolation = appointmentDto.IsForSelfIsolation; appointment.IsRecovered = appointmentDto.IsRecovered; appointment.IsTested = appointmentDto.IsTested; appointment.PatientId = appointmentDto.PatientId; appointmentData.Create(appointment); appointmentData.Commit(); return(CreatedAtRoute("GetAppointment", new { id = appointment.Id }, appointment)); }