public async Task <CommentDTO> GetCommentById(int commentId) { if (_cacheManager.IsSet(CacheKeys.GetCommentKey(commentId))) { return(_mapper.Map <CommentDTO>(_cacheManager.Get <Comment>(CacheKeys.GetCommentKey(commentId)))); } var comment = await _commentRepository.GetByIdAsync(commentId); if (comment == null) { throw new ArgumentNullException(nameof(Comment)); } return(_mapper.Map <CommentDTO>(comment)); }
public async Task UpdateCommentAsync(CommentDTO commentDTO) { await _commentRepository.UpdateAsync(_mapper.Map <Comment>(commentDTO)); _cacheManager.Remove(CacheKeys.GetCommentKey(commentDTO.Id)); }