public JsonResult AddCommentReply(int commentID, string content) { try { var userID = this.GetUserID(); if (userID <= 0) { return this.Json(new AjaxResponse(2, "未登录!")); } var commentReply = new Product_Comment_Reply { UserID = userID, CommentID = commentID, Content = content }; commentReply.ID = new ProductCommentReplyService().Add(commentReply); return this.Json(new AjaxResponse(1, "回复成功!")); } catch (Exception exception) { return this.Json(new AjaxResponse(0, "回复失败!:" + exception.Message)); } }
/// <summary> /// 添加评论的回复. /// </summary> /// <param name="commentReply"> /// Product_Comment_Reply. /// </param> /// <returns> /// 评论回复的编号. /// </returns> public int Add(Product_Comment_Reply commentReply) { return this.da.Insert(commentReply); }
/// <summary> /// 添加评论的回复. /// </summary> /// <param name="commentReply"> /// Product_Comment_Reply. /// </param> /// <returns> /// 评论回复的编号. /// </returns> public int Insert(Product_Comment_Reply commentReply) { if (commentReply == null) { throw new ArgumentNullException("commentReply"); } var parameters = new List<SqlParameter> { this.SqlServer.CreateSqlParameter( "CommentID", SqlDbType.Int, commentReply.CommentID, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "UserID", SqlDbType.Int, commentReply.UserID, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "ParentID", SqlDbType.Int, commentReply.ParentID, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "Content", SqlDbType.VarChar, commentReply.Content, ParameterDirection.Input), this.SqlServer.CreateSqlParameter( "ReferenceID", SqlDbType.Int, null, ParameterDirection.Output) }; this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Product_Comment_Reply_Insert", parameters, null); return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value; }