public async Task <IResult> Delete(CommentDeleteDto commentDeleteDto) { var comment = new Comment { Id = commentDeleteDto.Id }; await _commentDal.Delete(comment); return(new SuccessResult(Messages.CommentDeleted)); }
public async Task <IActionResult> Delete(CommentDeleteDto commentDeleteDto) { var entity = await _commentService.Delete(commentDeleteDto); if (entity.Success) { return(Ok(entity.Success)); } return(BadRequest(entity.Message)); }
public async Task <IActionResult> DeleteComment(Guid id) { var model = new CommentDeleteDto() { Id = id }; await _commentService.DeleteAsync(model); return(NoContent()); }
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); }
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); }