public IActionResult MyProfile()
        {
            var user_id = _userManager.GetUserId(HttpContext.User);
            var profile = _clinicianService.Get().FirstOrDefault(e => e.user_id == user_id);

            //get all the appointments of the profile
            ViewBag.appointment = _appointmentService.GetProfileAppointments(profile.id);
            ViewBag.schedules   = _clinicianAvailabilityService.Get(profile.id);
            //get the clients of the clinician
            ViewBag.profiles = _profileService.Get().Where(e => e.profile_type == 1);
            return(View("CProfile", profile));
        }
Пример #2
0
        public ActionResult NewAppointment(mp_appointment appointment)
        {
            var service    = DAL.Utils.Options.GetAppointmentServices().FirstOrDefault(e => e.id == appointment.appointment_service);
            var collection = Request.Form;
            var date       = collection["date"] + " " + collection["time"];
            var start_date = DateTime.Parse(date);

            appointment.start_date = start_date;
            appointment.end_date   = start_date.AddMinutes(service.time_minutes);


            Guid       logged_user_id = Guid.Parse(_userManager.GetUserId(HttpContext.User));
            mp_profile user_profile   = _profileService.GetByUserId(logged_user_id);

            appointment.client_id = user_profile.id;
            Guid appointment_id;

            var day_available = _clinicianAvailabilityService.Get().FirstOrDefault(e => e.day_name == start_date.DayOfWeek.ToString() && e.clinician_id == appointment.clinician_id);

            if (day_available != null)
            {
                // var clinician_available = _clinicianAvailabilityService.GetClinicianAvailabilityByDateRange(appointment);
                if (1 == 1)//if (AppointmentBL.IsClinicianAvailable(day_available.start_time,day_available.end_time,appointment.start_date,appointment.end_date))
                {
                    //clinician is available by settings
                    //now check if clinician already has appointment fixed
                    // var clinician_appointments = _appointmentService.GetClinicianAppointmentsByDateRange(appointment);
                    if (1 == 1)//if (AppointmentBL.IsAppointmentClashing(appointment.clinician_id,appointment))
                    {
                        //clinician does not have appointments set for that time
                        //fix appointment
                        appointment.status         = 169;
                        appointment_id             = _appointmentService.Add(appointment);
                        TempData["appointment_id"] = appointment_id;
                        TempData["AlertType"]      = "alert-success";
                        TempData["AlertMessage"]   = "We have found an available clinician for you. Please make payment to confirm your booking";
                        return(RedirectToAction(nameof(ConfirmAppointment)));
                    }
                }
            }
            //if we got here, then no clinician was available
            TempData["AlertType"]    = "alert-warning";
            TempData["AlertMessage"] = "Sorry, the clinician will not be available at the time you chose. Please can you review their availability and adjust.";
            return(RedirectToAction("NewAppointment", "Appointment", new { id = collection["profile_match"] }));
        }
Пример #3
0
 public IActionResult GetAvailability(Guid clinician_id)
 {
     return(Ok(_clinicianAvailabilityService.Get().Where(e => e.clinician_id == clinician_id)));
 }