public ActionResult ChangeStatus(long id, string status) { try { switch (status) { case "Scheduled": _appointmentService.ChangeAppointmentStatus(id, (int)AppointmentStatuses.Scheduled); break; case "Arrived": _appointmentService.ChangeAppointmentStatus(id, (int)AppointmentStatuses.Arrived); break; case "Cancelled": _appointmentService.ChangeAppointmentStatus(id, (int)AppointmentStatuses.Cancelled); break; case "Completed": _appointmentService.ChangeAppointmentStatus(id, (int)AppointmentStatuses.Completed); break; default: break; } } catch (Exception ex) { return(Content(ex.Message)); } return(Content("true")); }
public async Task <ActionResult> Approve(int appointmentId) => await Exec(async operation => { var(role, _) = VerifyUser(UserRole.Both); await appointmentService.ChangeAppointmentStatus(operation, role, appointmentId, AppointmentStatus.Approved); });