예제 #1
0
        public async Task <IResult> Delete(CommentDeleteDto commentDeleteDto)
        {
            var comment = new Comment
            {
                Id = commentDeleteDto.Id
            };
            await _commentDal.Delete(comment);

            return(new SuccessResult(Messages.CommentDeleted));
        }
예제 #2
0
        public async Task <IActionResult> Delete(CommentDeleteDto commentDeleteDto)
        {
            var entity = await _commentService.Delete(commentDeleteDto);

            if (entity.Success)
            {
                return(Ok(entity.Success));
            }
            return(BadRequest(entity.Message));
        }
예제 #3
0
        public async Task <IActionResult> DeleteComment(Guid id)
        {
            var model = new CommentDeleteDto()
            {
                Id = id
            };
            await _commentService.DeleteAsync(model);

            return(NoContent());
        }
예제 #4
0
        public async Task DeleteAsync(CommentDeleteDto dto)
        {
            if (dto.Id == Guid.Empty)
            {
                throw new ArticleException(ArticleErrorCodes.CommentIdCannotBeNull, "Comment Id field is mandatory.", dto);
            }

            var entity = await _articleRepository.GetByIdAsync(dto.Id);

            if (entity == null)
            {
                throw new ArticleException(ArticleErrorCodes.CommentCouldNotBeFound, "Comment could not be found.", dto);
            }

            await _articleRepository.DeleteAsync(entity);
        }
예제 #5
0
        public ResponseDto Delete(CommentDeleteDto deleteDto)
        {
            ResponseDto responseDto = new ResponseDto();

            CommentDeleteBo deleteBo = new CommentDeleteBo()
            {
                CommentId = deleteDto.CommentId,

                Session = Session
            };

            ResponseBo responseBo = commentBusiness.Delete(deleteBo);

            responseDto = responseBo.ToResponseDto();

            return(responseDto);
        }