public Task <DeleteCommentResponseDto> DeleteCommentByIdAsync(DeleteCommentRequestDto dto) { return(Task.Run(() => { var comment = _commentRepository.GetById(dto.Comment_id); var resp = new DeleteCommentResponseDto(); if (comment != null) { if (!comment.IsOffLine) { comment.IsOffLine = true; _commentRepository.Update(comment); _commentDeleteHistoryRepository.Insert(new CommentDeleteHistoryEntity() { CommentId = dto.Comment_id, Reason = dto.reason, GMTCreate = DateTime.Now, GMTModified = null }); resp.success = 1; } else { resp.success = 0; resp.msg = "评论不可重复删除"; } } else { resp.success = 0; resp.msg = "评论不存在"; } return resp; })); }
public async Task <IHttpActionResult> Post([FromBody] DeleteCommentRequestDto dto) { DeleteCommentResponseDto resp = await _commentService.DeleteCommentByIdAsync(dto); return(Ok(resp)); }