// GET: SymptomsPivots/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SymptomsPivot symptomsPivot = db.SymptomsPivots.Find(id);

            if (symptomsPivot == null)
            {
                return(HttpNotFound());
            }
            Patient[] sel = new Patient[1];
            sel[0]              = db.Patients.Find(symptomsPivot.patientID);
            ViewBag.patientID   = new SelectList(sel, "patientID", "patientID");
            ViewBag.datapieceID = new SelectList(db.PossibleSymptoms, "Id", "Name", symptomsPivot.datapieceID);
            if (User.Identity.IsAuthenticated)
            {
                ViewBag.displayMenu = "No";
                if (isAdminUser() || (sel[0].isCompare && sel[0].userName == User.Identity.GetUserName()))
                {
                    ViewBag.displayMenu = "Yes";
                }
            }
            return(View(symptomsPivot));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            SymptomsPivot symptomsPivot = db.SymptomsPivots.Find(id);

            db.SymptomsPivots.Remove(symptomsPivot);
            db.SaveChanges();
            return(RedirectToAction("Details", "Patients", new { id = symptomsPivot.patientID }));
        }
 public ActionResult Edit([Bind(Include = "Id,patientID,datapieceID,date,frequency,notes")] SymptomsPivot symptomsPivot)
 {
     if (ModelState.IsValid)
     {
         db.Entry(symptomsPivot).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Details", "Patients", new { id = symptomsPivot.patientID }));
     }
     Patient[] sel = new Patient[1];
     sel[0]              = db.Patients.Find(symptomsPivot.patientID);
     ViewBag.patientID   = new SelectList(sel, "patientID", "patientID");
     ViewBag.datapieceID = new SelectList(db.PossibleSymptoms, "Id", "Name", symptomsPivot.datapieceID);
     if (User.Identity.IsAuthenticated)
     {
         ViewBag.displayMenu = "No";
         if (isAdminUser() || (sel[0].isCompare && sel[0].userName == User.Identity.GetUserName()))
         {
             ViewBag.displayMenu = "Yes";
         }
     }
     return(View(symptomsPivot));
 }
        // GET: SymptomsPivots/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SymptomsPivot symptomsPivot = db.SymptomsPivots.Find(id);

            if (symptomsPivot == null)
            {
                return(HttpNotFound());
            }
            Patient p = symptomsPivot.Patient;

            if (User.Identity.IsAuthenticated)
            {
                ViewBag.displayMenu = "No";
                if (isAdminUser() || (p.isCompare && p.userName == User.Identity.GetUserName()))
                {
                    ViewBag.displayMenu = "Yes";
                }
            }
            return(View(symptomsPivot));
        }