public IHttpActionResult Update([FromBody] Appointment appointment) { try { return(Content(HttpStatusCode.OK, _appointmentManager.Update(appointment))); } catch (Exception ex) { return(Content(HttpStatusCode.InternalServerError, ex.Message)); } }
public void UpdateAppointment(Appointment appointment) { if (listViewDateTime.SelectedItems.Count > 0) { appointment.DesiredDateTime = dateTimePickerAppointment.Value; appointment.DoctorsRemarks = txtDoctorsRemarks.Text; var messageBoxResult = MessageBox.Show("Are you sure you want to update appointment?", "Confirm Update.", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (messageBoxResult == DialogResult.Yes) { if (appointmentManager.Update(appointment)) { InsertTestResultOfAppointment(appointment.Id); DeleteTestResults(); MessageBox.Show("Appointment updated successfully."); btnUpdateAppointment.Enabled = false; btnNewAppointment.Enabled = true; } } } }