public ActionResult EvidenceCommentsDeleteConfirmed(int id) { if (!isAdminUser()) { return(RedirectToAction("Index", "User")); } EvidenceComment evidenceComment = db.EvidenceComments.Find(id); db.EvidenceComments.Remove(evidenceComment); db.SaveChanges(); return(RedirectToAction("EvidenceCommentsIndex")); }
public ActionResult EvidenceCommentsEdit([Bind(Include = "EvidenceCommentId,EvidenceId,Name,Email,Date,Content")] EvidenceComment evidenceComment) { if (!isAdminUser()) { return(RedirectToAction("Index", "User")); } if (ModelState.IsValid) { db.Entry(evidenceComment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("EvidenceCommentsIndex")); } return(View("EvidenceComments/Edit", evidenceComment)); }
public ActionResult PostComment() { EvidenceComment com = new EvidenceComment(); string[] keys = Request.Form.AllKeys; com.EvidenceId = int.Parse(Request.Form.Keys[3]); com.Name = Request.Form[keys[0]]; com.Email = Request.Form[keys[1]]; com.Date = DateTime.Now.Date; com.Content = Request.Form[keys[2]]; db.EvidenceComments.Add(com); db.SaveChanges(); return(RedirectToAction("Evidence/" + com.EvidenceId)); }
public ActionResult EvidenceCommentsCreate([Bind(Include = "EvidenceCommentId,EvidenceId,Name,Email,Date,Content")] EvidenceComment evidenceComment) { if (!isAdminUser()) { return(RedirectToAction("Index", "User")); } if (ModelState.IsValid) { db.EvidenceComments.Add(evidenceComment); db.SaveChanges(); return(RedirectToAction("EvidenceCommentIndex")); } return(View("EvidenceComments/Create", evidenceComment)); }
// GET: EvidenceComments/Delete/5 public ActionResult EvidenceCommentsDelete(int?id) { if (!isAdminUser()) { return(RedirectToAction("Index", "User")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EvidenceComment evidenceComment = db.EvidenceComments.Find(id); if (evidenceComment == null) { return(HttpNotFound()); } return(View("EvidenceComments/Delete", evidenceComment)); }