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