// GET: PatientInterviews/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            //sprawdzenie czy pacjent jest wsród pacjentów lekarza
            if (User.IsInRole("Doctor"))
            {
                var doctorId = User.Identity.GetUserId();
                var doctor   = db.Doctor.SingleOrDefault(d => d.AspNetUsers_Id == doctorId);
                var patient  = doctor.Patient.SingleOrDefault(p => p.AspNetUsers_Id == id);
                if (patient == null)
                {
                    return(HttpNotFound());
                }
            }

            PatientInterview patientInterview = db.PatientInterview.Find(id);

            if (patientInterview == null)
            {
                return(HttpNotFound());
            }
            return(View(patientInterview));
        }
        public ActionResult DeleteConfirmed(string id)
        {
            PatientInterview patientInterview = db.PatientInterview.Find(id);

            db.PatientInterview.Remove(patientInterview);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Patient_AspNetUsers_Id,DiastolicPressure,SystolicPressure,Surgery,DiseaseInFamily,Smoking,Health")] PatientInterview patientInterview)
 {
     if (ModelState.IsValid)
     {
         db.Entry(patientInterview).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Patient_AspNetUsers_Id = new SelectList(db.Patient, "AspNetUsers_Id", "AspNetUsers_Id", patientInterview.Patient_AspNetUsers_Id);
     return(View(patientInterview));
 }
        public ActionResult Create([Bind(Include = "DiastolicPressure,SystolicPressure,Surgery,DiseaseInFamily,Smoking,Health")] PatientInterview patientInterview)
        {
            patientInterview.Patient_AspNetUsers_Id = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                db.PatientInterview.Add(patientInterview);
                db.SaveChanges();
                return(RedirectToAction("Create", "Diaries"));
            }

            ViewBag.Patient_AspNetUsers_Id = new SelectList(db.Patient, "AspNetUsers_Id", "AspNetUsers_Id", patientInterview.Patient_AspNetUsers_Id);
            return(View(patientInterview));
        }
        // GET: PatientInterviews/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PatientInterview patientInterview = db.PatientInterview.Find(id);

            if (patientInterview == null)
            {
                return(HttpNotFound());
            }
            return(View(patientInterview));
        }
        // GET: PatientInterviews/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PatientInterview patientInterview = db.PatientInterview.Find(id);

            if (patientInterview == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Patient_AspNetUsers_Id = new SelectList(db.Patient, "AspNetUsers_Id", "AspNetUsers_Id", patientInterview.Patient_AspNetUsers_Id);
            return(View(patientInterview));
        }