protected void rptComment_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Remove") { var commentId = Convert.ToInt32(e.CommandArgument); var userpostindex = e.Item.ItemIndex; BLL.Comment selecteduserpost = CommentDAO.GetCommentById(commentId); if (currentUser.Id == selecteduserpost.UserId) { CommentDAO.DeleteComment(commentId); refreshGv(); } } }
public void DeleteCommentTest() { Comment comment = new Comment(); comment.Text = "Very nice."; comment.Date = DateTime.Now; comment.MovieId = 5; comment.ClientId = 10; CommentDAO commentDAO = new CommentDAO(); commentDAO.AddComment(comment); List <Comment> list = commentDAO.GetCommentsByMovie((int)comment.MovieId); comment = list[list.Count - 1]; commentDAO.DeleteComment(comment.Id); list = commentDAO.GetCommentsByMovie((int)comment.MovieId); Assert.IsFalse(list.Exists(l => l.Id == comment.Id)); }
public void DeleteComment(int cID) { CommentDAO dao = new CommentDAO(); dao.DeleteComment(cID); }
/// <summary> /// 删除评论 /// </summary> /// <param name="cid"></param> /// <returns></returns> public bool DeleteComment(int cid, int userid) { return(dao.DeleteComment(cid, userid)); }
/// <summary> /// Delete comment. /// </summary> /// <param name="comment">Comment object</param> /// <returns></returns> public bool DeleteComment(int id) { return(comdao.DeleteComment(id)); }