예제 #1
0
        public Tournoi GetTournament([FromQuery] int id)
        {
            var t = DB_CURD.GetTournament(id);

            Tournoi retour = new()
            {
                IdTournament    = t.IdTournament,
                Name            = t.Name,
                Date            = t.Date,
                Description     = t.Description,
                jeu             = DB_CURD.GetJeu(t.IdGame),
                Dotation        = DB_CURD.GetDotationsOf(t.IdTournament),
                Resultas        = DB_CURD.GetResultasOfTournament(t.IdTournament),
                Participants    = DB_CURD.GetParticipantsOf(t.IdTournament),
                Organisateurs   = DB_CURD.GetOrgasOf(t.IdTournament),
                DeckListNumber  = t.DeckListNumber,
                MaxNumberPlayer = t.MaxNumberPlayer,
                Ppwin           = t.Ppwin,
                Ppdraw          = t.Ppdraw,
                Pplose          = t.Pplose,
                Over            = t.Over,
                Deleted         = t.Deleted,
                Matchs          = GetMatchsOfTournament(t.IdTournament),
                Rounds          = GetRoundsOfTournament(t.IdTournament)
            };

            if (retour.Over)
            {
                retour.Resultas = DB_CURD.GetResultasOfTournament(retour.IdTournament);
            }
            if (retour.Deleted == null)
            {
                var c = DB_CURD.GetScoreClassementTemporairesOfTournamnent(retour.IdTournament);
                retour.Classement = c.Any() ? c : null;
            }

            return(retour);
        }
예제 #2
0
        public RetourAPI CreateMatchAllPairing(Round Round)
        {
            List <int> Players = new();

            foreach (ViewParticipant p in DB_CURD.GetParticipantsOf(Round.IdTournament))
            {
                if (!p.Drop)
                {
                    Players.Add(p.IdUser);
                }
            }

            List <ViewScoreClassementTemporaire> Classements =
                DB_CURD.GetScoreClassementTemporairesOfTournamnent(Round.IdTournament);
            List <ViewMatch> Matches = DB_CURD.GetMatchesOf(Round.IdTournament);
            ViewTournament   Tournoi = DB_CURD.GetTournament(Round.IdTournament);

            List <PairID> PairingList = AlgoPairing.Pairing(Players, Classements, Matches, Round.RoundNumber);

            return(DB_CURD.CreateMatchAllParing(Round, PairingList));
        }