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