Example #1
0
        public StreamComment UpdateComment(String text, StreamComment comment)
        {
            try
            {
                CommentApi      commentApi    = new CommentApi(session.GetApiClient());
                CommentV2Record commentRecord = comment.Record;
                commentRecord.Text = text;

                UpdateCommentInput  updateCommentInput  = new UpdateCommentInput(comment.ContentKey, commentRecord);
                UpdateCommentResult updateCommentResult = commentApi.UpdateComment(updateCommentInput);
                if (updateCommentResult.Hdr.Rc == 0)
                {
                    CommentV2Record updatedCommentRecord = updateCommentResult.Comment;
                    StreamComment   updatedComment       = new StreamComment(updatedCommentRecord, comment.ContentRecordType);
                    return(updatedComment);
                }
                else
                {
                    throw new Exception("Error creating comment. Rc=" + updateCommentResult.Hdr.Rc);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error creating comment", ex);
            }
        }
Example #2
0
 public virtual async Task <CommentDto> UpdateAsync(Guid id, UpdateCommentInput input)
 {
     return(await RequestAsync <CommentDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
     {
         { typeof(Guid), id },
         { typeof(UpdateCommentInput), input }
     }));
 }
Example #3
0
    public virtual async Task <CommentDto> UpdateAsync(Guid id, UpdateCommentInput input)
    {
        var comment = await CommentRepository.GetAsync(id);

        if (comment.CreatorId != CurrentUser.GetId())
        {
            throw new AbpAuthorizationException();
        }

        comment.SetText(input.Text);
        comment.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp);

        var updatedComment = await CommentRepository.UpdateAsync(comment);

        return(ObjectMapper.Map <Comment, CommentDto>(updatedComment));
    }
Example #4
0
        public async Task UpdateComment([FromBody] UpdateCommentInput input, Guid interactionId)
        {
            var getInput = new GetOrDeleteCommentInput
            {
                ObjectId       = input.ObjectId,
                ObjectTypeEnum = input.ObjectTypeEnum
            };
            var comment = await GetComment(getInput, interactionId);

            if (comment != null)
            {
                comment.Message = input.Message;
                Repository.Update(comment);
                await Context.SaveChangesAsync();
            }
        }
Example #5
0
 public Task <CommentDto> UpdateAsync(Guid id, UpdateCommentInput input)
 {
     return(CommentPublicAppService.UpdateAsync(id, input));
 }
 public void Update(UpdateCommentInput input)
 {
     Models.Comment output = Mapper.Map <UpdateCommentInput, Models.Comment>(input);
     _commentManager.Update(output);
 }