Exemplo n.º 1
0
        public bool PutDisLike(ArtCommentPlus artCommentPlus)
        {
            SqlConnection sqlConnection = new SqlConnection(connectionstring);

            sqlConnection.Open();
            using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
            {
                SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
                try
                {
                    string sql = "update ArticalCmtTable set DownArtCmtnum =DownArtCmtnum+1 where Articalid=@Articalid and ArtCmtUserid=@ArtCmtUserid and ArtCmtedUserid=@ArtCmtedUserid and ArtCmtTime=@ArtCmtTime";
                    sqlCommand.CommandText = sql;
                    sqlCommand.Transaction = sqlTransaction;
                    sqlCommand.Parameters.AddWithValue("@Articalid", artCommentPlus.Articalid);
                    sqlCommand.Parameters.AddWithValue("@ArtCmtUserid", artCommentPlus.CmdUserid);
                    sqlCommand.Parameters.AddWithValue("@ArtCmtedUserid", artCommentPlus.CmtedUserid);
                    sqlCommand.Parameters.AddWithValue("ArtCmtTime", artCommentPlus.Datetime);
                    sqlCommand.ExecuteNonQuery();
                    sqlTransaction.Commit();
                    return(true);
                }
                catch (SqlException)
                {
                    sqlTransaction.Rollback();
                    return(false);
                }
                finally
                {
                    sqlConnection.Close();
                }
            }
        }
        public bool Delputdislike([FromBody] ArtCommentPlus artCommentPlus)
        {
            ArtCommentAccess artCommentAccess = new ArtCommentAccess();

            return(artCommentAccess.DelPutDisLike(artCommentPlus));
        }
        public bool PutLike([FromBody] ArtCommentPlus artCommentPlus)
        {
            ArtCommentAccess artCommentAccess = new ArtCommentAccess();

            return(artCommentAccess.PutLike(artCommentPlus));
        }