public async Task <IActionResult> Update(CommentForAddUpdateDto dto)
        {
            var result = await _commentService.Update(dto);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Exemplo n.º 2
0
        public async Task <IResult> Update(CommentForAddUpdateDto dto)
        {
            var isCommentExists = await _commentDal.GetAsync(c => c.Id == dto.Id);

            if (isCommentExists == null)
            {
                return(new ErrorResult(Messages.CommentNotFound));
            }
            await _commentDal.UpdateAsync(dto.Map(isCommentExists));

            return(new SuccessResult(Messages.UpdatedSuccessfully));
        }
Exemplo n.º 3
0
        public async Task <IResult> Add(CommentForAddUpdateDto dto)
        {
            await _commentDal.AddAsync(dto.Map <Comment>());

            return(new SuccessResult(Messages.AddedSuccessfully));
        }