Esempio n. 1
0
        public IActionResult Index() //Dashboard
        {
            if (accVeri.CheckIfLoggedIn(HttpContext.Session.GetInt32("AccountID")) == false)
            {
                return(RedirectToAction("LogOut", "Account"));
            }

            appointmentViewModel.appointments = new List <AppointmentDetailViewModel>();

            Account opgehaald = new Account();

            opgehaald.AccountID = (int)HttpContext.Session.GetInt32("AccountID");

            if ((HttpContext.Session.GetInt32("Doctor") != 1 && HttpContext.Session.GetInt32("Admin") != 1))
            {
                //Patient
                ViewBag.LinkedDoctors = accountrepo.GetDoctorsFromPatient(opgehaald.AccountID);
            }
            else
            {
                //Doctor or Admin
                ViewBag.LinkedPatients = accountrepo.GetLinkedPatientsByDoctorID(opgehaald.AccountID);
            }

            foreach (Appointment appointment in appointmentrepo.AppointmentsCurrentWeek(opgehaald.AccountID))
            {
                appointmentViewModel.appointments.Add(appointmentConverter.ViewModelFromAppointment(appointment));
            }

            return(View(appointmentViewModel));
        }
Esempio n. 2
0
        public IActionResult Agenda()
        {
            if (accVeri.CheckIfLoggedIn(HttpContext.Session.GetInt32("AccountID")) == false)
            {
                return(RedirectToAction("Login", "Account"));
            }

            AppointmentViewModel viewmodel = new AppointmentViewModel();

            Account account = new Account();

            account.AccountID = (int)HttpContext.Session.GetInt32("AccountID");

            foreach (Appointment appointment in appointmentrepo.AppointmentsCurrentWeek(account.AccountID))
            {
                appointment.doctor  = accountrepo.GetAccountByID(appointment.doctor.AccountID);
                appointment.patient = accountrepo.GetAccountByID(appointment.patient.AccountID);
                viewmodel.appointments.Add(appointmentconverter.ViewModelFromAppointment(appointment));
            }

            return(View(viewmodel));
        }