// GET: CommentForms/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommentForms commentForms = db.CommentForms.Find(id); if (commentForms == null) { return(HttpNotFound()); } var viewModel = new CommentFormViewModel { CommentForms = commentForms, //We don't want to pull back all the procedures, just the one with the //same priority as our comment Procedure = (from p in db.Procedures where p.Priority == commentForms.Priority select p).First() }; return(View(viewModel)); }
public ActionResult DeleteConfirmed(int id) { CommentForms commentForms = db.CommentForms.Find(id); db.CommentForms.Remove(commentForms); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CommentID,Name,Comment,Priority,ProcedureID")] CommentForms commentForms) { if (ModelState.IsValid) { db.Entry(commentForms).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProcedureID = new SelectList(db.Procedures, "ProcedureID", "Title", commentForms.ProcedureID); return(View(commentForms)); }
// GET: CommentForms/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommentForms commentForms = db.CommentForms.Find(id); if (commentForms == null) { return(HttpNotFound()); } return(View(commentForms)); }
// GET: CommentForms/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommentForms commentForms = db.CommentForms.Find(id); if (commentForms == null) { return(HttpNotFound()); } ViewBag.ProcedureID = new SelectList(db.Procedures, "ProcedureID", "Title", commentForms.ProcedureID); return(View(commentForms)); }