Example #1
0
        public async Task <ActionResult> DeleteAdminBlogPostCommentAsync(int id, int commentId)
        {
            var comment = await _blogPostCommentsRepository.ReadByIdAsync(commentId);

            if (comment is null)
            {
                return(NotFound());
            }

            await _blogPostCommentsRepository.DeleteAsync(comment);

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <CommentVm> > GetBlogPostCommentAsync(int id, int commentId)
        {
            var blogPost = await _blogPostsRepository.ReadByIdAsync(id);

            if (blogPost.Status != EnBlogPostStatus.Published)
            {
                return(BadRequest());
            }

            var comment = await _blogPostCommentsRepository.ReadByIdAsync(commentId);

            if (comment is null)
            {
                return(NotFound());
            }

            return(_mapper.Map <CommentVm>(comment));
        }