コード例 #1
0
ファイル: ManageController.cs プロジェクト: Doronaim/RIME
        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"));
        }
コード例 #2
0
ファイル: ManageController.cs プロジェクト: Doronaim/RIME
 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));
 }
コード例 #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));
        }
コード例 #4
0
ファイル: ManageController.cs プロジェクト: Doronaim/RIME
        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));
        }
コード例 #5
0
ファイル: ManageController.cs プロジェクト: Doronaim/RIME
        // 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));
        }