コード例 #1
0
 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();
         }
     }
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        public void DeleteComment(int cID)
        {
            CommentDAO dao = new CommentDAO();

            dao.DeleteComment(cID);
        }
コード例 #4
0
 /// <summary>
 /// 删除评论
 /// </summary>
 /// <param name="cid"></param>
 /// <returns></returns>
 public bool DeleteComment(int cid, int userid)
 {
     return(dao.DeleteComment(cid, userid));
 }
コード例 #5
0
 /// <summary>
 /// Delete comment.
 /// </summary>
 /// <param name="comment">Comment object</param>
 /// <returns></returns>
 public bool DeleteComment(int id)
 {
     return(comdao.DeleteComment(id));
 }