Exemple #1
0
        private async Task <Unit> AddToDatabaseAsync(FollowEntity follow, CancellationToken cancellationToken)
        {
            await _followRepo.AddAsync(follow, cancellationToken);

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

            throw new DatabaseException("Error occured while updating database.");
        }
        private async Task <Unit> RemoveFollowFromDatabaseAsync(FollowEntity follow)
        {
            await _followRepo.RemoveAsync(follow);

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

            throw new DatabaseException("Error occured while updating database.");
        }