public ActionResult DeleteConfirmed(int id) { DrugHistory drughistory = db.DrugHistories.Find(id); db.DrugHistories.Remove(drughistory); db.SaveChanges(User.Identity.Name); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Dosage,StartDate,EndDate,Comment,Participant_Id,Drug_Id")] DrugHistory drughistory) { if (ModelState.IsValid) { db.Entry(drughistory).State = EntityState.Modified; db.SaveChanges(User.Identity.Name); return(RedirectToAction("Index")); } ViewBag.Drug_Id = new SelectList(db.Drugs, "Id", "Name", drughistory.Drug_Id); ViewBag.Participant_Id = new SelectList(db.Participants, "Id", "FirstName", drughistory.Participant_Id); return(View(drughistory)); }
// GET: /DrugHistory/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DrugHistory drughistory = db.DrugHistories.Find(id); if (drughistory == null) { return(HttpNotFound()); } return(View(drughistory)); }
// GET: /DrugHistory/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DrugHistory drughistory = db.DrugHistories.Find(id); if (drughistory == null) { return(HttpNotFound()); } ViewBag.Drug_Id = new SelectList(db.Drugs, "Id", "Name", drughistory.Drug_Id); ViewBag.Participant_Id = new SelectList(db.Participants, "Id", "FirstName", drughistory.Participant_Id); return(View(drughistory)); }