Esempio n. 1
0
        public Result Handle(RemoveRoundFromTournament command)
        {
            Tournament tournament = _tournamentRepository.GetTournamentById(command.TournamentId);

            if (tournament == null)
            {
                return(Result.Failure($"Could not remove round ({ command.RoundId }) from tournament ({ command.TournamentId }). Tournament not found."));
            }

            bool roundRemoved = _tournamentRepository.RemoveRoundFromTournament(tournament, command.RoundId);

            if (!roundRemoved)
            {
                return(Result.Failure($"Could not remove round ({ command.RoundId }) from tournament ({ command.TournamentId })."));
            }

            _tournamentRepository.Save();
            return(Result.Success());
        }