public ActionResult DeleteCommentReply(int id) { AnCommentReply anCommentReply = db.AnCommentReplys.Find(id); db.AnCommentReplys.Remove(anCommentReply); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult PostCommentReply(CommentReplyViewModel obj) { int userid = 1; AnCommentReply reply = new AnCommentReply(); reply.UserId = userid; reply.CommentReplyText = obj.AnCommentReply; if (reply.CommentReplyText == null) { return(RedirectToAction("Error")); } reply.CommentId = obj.ACommentId; db.AnCommentReplys.Add(reply); db.SaveChanges(); return(RedirectToAction("Index")); }