Esempio n. 1
0
        public IActionResult SaveComment(CreateTextCommentContract comment, long textId)
        {
            var client = GetProjectClient();
            var result = client.CreateComment(textId, comment);

            return(Json(result));
        }
Esempio n. 2
0
 public CreateNewTextCommentWork(ResourceRepository resourceRepository, long textId, CreateTextCommentContract newComment, int userId) : base(resourceRepository)
 {
     m_resourceRepository = resourceRepository;
     m_textId             = textId;
     m_newComment         = newComment;
     m_userId             = userId;
 }
Esempio n. 3
0
        public long CreateNewComment(long textId, CreateTextCommentContract newComment)
        {
            var userId = m_authenticationManager.GetCurrentUserId();
            var createNewCommentWork = new CreateNewTextCommentWork(m_resourceRepository, textId, newComment, userId);
            var resultId             = createNewCommentWork.Execute();

            return(resultId);
        }
Esempio n. 4
0
        public IActionResult CreateComment(long textId, [FromBody] CreateTextCommentContract request)
        {
            m_authorizationManager.AuthorizeResource(textId, PermissionFlag.EditProject);

            try
            {
                var resultId = m_projectContentManager.CreateNewComment(textId, request);
                return(Ok(resultId));
            }
            catch (HttpErrorCodeException exception)
            {
                return(StatusCode((int)exception.StatusCode, exception.Message));
            }
        }
Esempio n. 5
0
        public void UpdateComment(long commentId, CreateTextCommentContract request)
        {
            try
            {
                m_client.Put <object>($"project/text/comment/{commentId}", request);
            }
            catch (HttpRequestException e)
            {
                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e);
                }

                throw;
            }
        }
Esempio n. 6
0
        public long CreateComment(long textId, CreateTextCommentContract request)
        {
            try
            {
                var result = m_client.Post <long>($"project/text/{textId}/comment", request);
                return(result);
            }
            catch (HttpRequestException e)
            {
                if (m_logger.IsErrorEnabled())
                {
                    m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e);
                }

                throw;
            }
        }
Esempio n. 7
0
        public void UpdateComment(CreateTextCommentContract comment, long commentId)
        {
            var client = GetProjectClient();

            client.UpdateComment(commentId, comment);
        }