예제 #1
0
        public ActionResult Index()
        {
            // retrieve clinic info if exists
            var clinic = _clinicRepository.GetClinic();

            if (clinic != null)
            {
                var clinicViewModel = new ClinicViewModel()
                {
                    Id          = clinic.Id,
                    Name        = clinic.Name,
                    PhoneNumber = clinic.PhoneNumber,
                    Address     = clinic.Address,
                    FaxNumber   = clinic.FaxNumber,
                    // ensure days are in order
                    ClinicDays = clinic.ClinicDays.OrderBy(s => (int)(s.Day)).ToList()
                };

                return(View(clinicViewModel));
            }

            return(View());
        }
예제 #2
0
        public ActionResult AvailableAppointments(int id, DateTime date)
        {
            if (ModelState.IsValid)
            {
                // get patient
                var patient = _patientRepository.GetPatient(id);

                //get clinic info
                var clinic = _clinicRepository.GetClinic();

                // get availabe list of appointmets for selected date
                var appointments = _appointmentRepository
                                   .GetAvailableAppointments(date, clinic.Id);

                var appointmentsList = new List <SelectListItem>();

                foreach (var app in appointments)
                {
                    appointmentsList.Add(new SelectListItem {
                        Value = app.StartTime, Text = app.StartTime
                    });
                }

                // construct model
                BookAppointmentViewModel bookAppointmentModel = new BookAppointmentViewModel()
                {
                    PatientId    = patient.Id,
                    FirstName    = patient.FirstName,
                    LastName     = patient.LastName,
                    DateOfBirth  = patient.DateOfBirth,
                    PhoneNumber  = patient.PhoneNumber,
                    Date         = date,
                    Appointments = appointmentsList
                };

                return(View(bookAppointmentModel));
            }

            return(HttpNotFound());
        }
예제 #3
0
        public ViewResult Details(int id)
        {
            Clinic model = _clinicRepository.GetClinic(id);

            return(View(model));
        }