Esempio n. 1
0
        private async Task <Unit> AddToDatabaseAsync(CommentEntity comment, CancellationToken cancellationToken)
        {
            await _commentRepo.AddAsync(comment, cancellationToken);

            if (await _commentRepo.SaveAllAsync())
            {
                return(await Task.FromResult(Unit.Value));
            }

            throw new DatabaseException("Error occured while adding comment.");
        }