예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            WA_Comments wa_comments = db.WA_Comments.Find(id);

            db.WA_Comments.Remove(wa_comments);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        private void DeleteComments(WA_Comments comment)
        {
            var commentChil = comment.WA_Comments1.ToList();

            for (int i = 0; i < commentChil.Count; i++)
            {
                DeleteComments(commentChil[i]);
            }
            db.WA_Comments.Remove(comment);
            db.SaveChanges();
        }
예제 #3
0
 public ActionResult Edit([Bind(Include = "CommentID,ContenComment,PostID,Author,Created,Parent")] WA_Comments wa_comments)
 {
     if (ModelState.IsValid)
     {
         db.Entry(wa_comments).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PostID = new SelectList(db.WA_Posts, "PostID", "Title", wa_comments.PostID);
     ViewBag.Author = new SelectList(db.WA_Users, "UserID", "UserName", wa_comments.Author);
     return(View(wa_comments));
 }
예제 #4
0
        // GET: /Comments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WA_Comments wa_comments = db.WA_Comments.Find(id);

            if (wa_comments == null)
            {
                return(HttpNotFound());
            }
            return(View(wa_comments));
        }
예제 #5
0
        // GET: /Comments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WA_Comments wa_comments = db.WA_Comments.Find(id);

            if (wa_comments == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PostID = new SelectList(db.WA_Posts, "PostID", "Title", wa_comments.PostID);
            ViewBag.Author = new SelectList(db.WA_Users, "UserID", "UserName", wa_comments.Author);
            return(View(wa_comments));
        }