// GET: Management/PostComments/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PostComment postComment = db.PostComments.Find(id); if (postComment == null) { return(HttpNotFound()); } return(View(PostCommentModel.FromEntity(postComment))); }
// GET: Management/PostComments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PostComment postComment = db.PostComments.Find(id); if (postComment == null) { return(HttpNotFound()); } ViewData["PostId"] = new SelectList(db.Posts, "Id", "Title", postComment.PostId); ViewData["ParentCommentId"] = new SelectList(db.PostComments, "Id", "AuthorEmail", postComment.ParentCommentId); ViewData["AuthorId"] = new SelectList(db.Users, "Id", "Email", postComment.AuthorId); return(View(PostCommentModel.FromEntity(postComment))); }
// GET: Management/PostComments public ActionResult Index() { IQueryable <PostComment> postComments = db.PostComments.Include(p => p.Post).Include(p => p.ParentPostComment).Include(p => p.User); return(View(PostCommentModel.FromEntity(postComments))); }