//[HttpPost] public IActionResult DeleteComment(string objId) { var arr = objId.Split("*"); var postId = int.Parse(arr[1]); var publisherId = arr[2]; var date = arr[3]; if (_context.DeleteComment(postId, publisherId, date)) { return(Json("success")); } return(Json("error")); }
public bool DeleteComment(string text, ObjectId postId) { Comment comment = new Comment(); comment.Text = text; comment.CommentatorId = userRepository.GetUser(userServices.NickNameRead()).Id; try { repository.DeleteComment(comment, postId); return(true); } catch { return(false); } }
public ActionResult DeleteComment(int commentId, int postId) { _postRepository.DeleteComment(commentId); return(RedirectToAction("ViewPost", "Post", new { id = postId })); }