public Response <CommentResponse> addTaskComment(AddTaskCommentRequest request) { var result = new Response <CommentResponse>(); try { result.Result = _service.addTaskComment(request); } catch (Exception ex) { result.Code = 500; result.Message = ex.Message; } return(result); }
/// <summary> /// 新增项目评论 /// </summary> /// <param name="content"></param> /// <param name="projectId"></param> /// <returns></returns> public CommentResponse addTaskComment(AddTaskCommentRequest request) { var comment = new Comment { Content = request.content, Type = 1, SubmitterId = user.UserId, CreateTime = DateTime.Now, DocId = request.taskId, TargetId = request.targetUserId }; if (request.parentId > 0) { comment.ParentId = request.parentId; } var returnId = Db.Insertable(comment).ExecuteCommand(); var commentUser = Db.Queryable <Users>().Where(u => u.userId == user.UserId).Select(u => new CommentUserResponse { id = u.userId, nickName = u.userName, avatar = u.avatar }).First(); var targetUser = Db.Queryable <Users>().Where(u => u.userId == request.targetUserId).Select(u => new CommentUserResponse { id = u.userId, nickName = u.userName, avatar = u.avatar }).First(); var commentResponse = new CommentResponse { id = returnId, childrenList = null, commentUser = commentUser, targetUser = targetUser, content = request.content, createDate = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") }; return(commentResponse); }