public ActionResult CancelAppointment(CancelAppointmentViewModel model)
        {
            try
            {
                var authInfo = (AuthInfo)Session["auth_info"];
                if (authInfo == null)
                {
                    return(Json(new KeyValueResult(false, "Your session has expired. Please signin again."), JsonRequestBehavior.AllowGet));
                }
                var data = new CancelAppoinmentModel
                {
                    AppointmentId = model.AppointmentId,
                    DoctorName    = model.DoctorName,
                    ClinicName    = authInfo.CurrentSelectedClinic.ClinicName,
                    ClinicPhone   = authInfo.CurrentSelectedClinic.Phone,
                    Patient       = new PatientCreateAppointmentModel
                    {
                        FirstName = model.PatientFirstName,
                        LastName  = model.PatientLastName,
                        Phone     = model.PatientPhone,
                        Email     = model.PatientEmail
                    },
                    ExpectedStartDateTime = model.ExpectedStartDateTime,
                };

                _appointmentService.CancelAppointment(data);
                return(Json(new KeyValueResult(true, "Welio appointment successfully canceled."), JsonRequestBehavior.AllowGet));
            }
            catch (ApiException ex)
            {
                return(Json(new KeyValueResult(false, ex.Message), JsonRequestBehavior.AllowGet));
            }
        }
示例#2
0
        public ActionResult CancelAppointment()
        {
            var patients = GetNamesOfPatients();
            var booked   = new List <AppointmentModel>();// GetBookedTerms(patients.First().UserInfoID);

            var viewModel = new CancelAppointmentViewModel
            {
                Patients            = patients,
                PatientAppointments = booked
            };

            return(View(viewModel));
        }