Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 3
0
        public async Task <IActionResult> DeleteComment(Guid id)
        {
            var model = new CommentDeleteDto()
            {
                Id = id
            };
            await _commentService.DeleteAsync(model);

            return(NoContent());
        }
Esempio n. 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);
        }
Esempio n. 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);
        }