Exemple #1
0
        public async Task AddComment(BlogPostCommentDto blogPostCommentDto)
        {
            var requestMessage = _apiClient.CreatePostRequest($"{_appSettings.BlogApiUrl}{BasePath}/AddComment", blogPostCommentDto);
            var response       = await _apiClient.SendAsync(requestMessage);

            string responseBody = await response.Content.ReadAsStringAsync();
        }
        public void InsertBlogPostComment(BlogPostCommentDto blogPostCommentDto)
        {
            var comment = new Repository.Domain.Blog.Comment()
            {
                Approved = blogPostCommentDto.Approved, BlogPostId = blogPostCommentDto.BlogPostId, CommentBody = blogPostCommentDto.Comment, CommenterEmail = blogPostCommentDto.CommenterEmail, CommenterName = blogPostCommentDto.CommenterFullName, CreatedOnUtc = DateTime.UtcNow
            };

            _unitOfWork.Comments.Insert(comment);
            _unitOfWork.Commit();
            _cacheManager.RemoveByPattern(BlogpostPatternKey);
        }
        public void UpdateBlogPostComment(BlogPostCommentDto blogPostCommentDto)
        {
            var comment = _unitOfWork.Comments.GetById(blogPostCommentDto.CommentId);

            if (comment != null)
            {
                comment.Approved       = blogPostCommentDto.Approved;
                comment.CommentBody    = blogPostCommentDto.Comment;
                comment.CommenterEmail = blogPostCommentDto.CommenterEmail;
                comment.CommenterName  = blogPostCommentDto.CommenterFullName;

                _unitOfWork.Comments.Update(comment);
                _unitOfWork.Commit();
                _cacheManager.RemoveByPattern(BlogpostPatternKey);
            }
        }