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")); }
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(); }
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)); }
// 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)); }
// 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)); }