Ejemplo n.º 1
0
        public IActionResult Index()
        {
            if (User.FindFirstValue(ClaimTypes.Role) == "Admin")
            {
                return(RedirectToAction("RegisterDoctor", "Register"));
            }

            Patient = new Patient();

            List <Patient> treatedPatients =
                _db.Patient.Include(tp => tp.CurrenctDoctor).Where(patient => patient.NotPatientAnymore == false && patient.CurrenctDoctor.Pesel == User.FindFirstValue(ClaimTypes.NameIdentifier)).ToList();

            ViewBag.TreatedPatients = treatedPatients;

            ViewBag.AllDoctors     = _db.User.Where(u => u.Pesel != User.FindFirstValue(ClaimTypes.NameIdentifier)).ToList();
            ViewBag.SharedPatients = _db.SharedPatients.Include(sp => sp.Doctor).Include(sp => sp.Patient).ToList();

            ViewBag.Username = HttpContext.User.Identity.Name;
            return(View(Patient));
        }
Ejemplo n.º 2
0
        public IActionResult Timetable()
        {
            List <Patient> treatedPatients =
                _db.Patient.Where(patient => patient.NotPatientAnymore == false && patient.CurrenctDoctor.Pesel == User.FindFirstValue(ClaimTypes.NameIdentifier)).ToList();

            treatedPatients.AddRange(_db.SharedPatients.Where
                                         (sp => !sp.Patient.NotPatientAnymore &&
                                         sp.Doctor.Pesel == User.FindFirstValue(ClaimTypes.NameIdentifier))
                                     .Include
                                         (sp => sp.Patient).Select
                                         (sp => sp.Patient).ToList());
            ViewBag.TreatedPatients = treatedPatients;

            TimetableVisit = new TimetableVisit();
            return(View(TimetableVisit));
        }