Example #1
0
        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"));
        }
Example #2
0
 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));
 }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        // 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));
        }