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