Beispiel #1
0
        public static void SaveMatchUpToFile(this MatchUpModel model)
        {
            //0-id,1-entries (id|id|id),2-winner,3-matchupround
            List <MatchUpModel> matchUps = GlobalConfig.MatchUpFile.FullFileName().LoadFile().ConvertToMatchUpModels();

            int currentId = matchUps.Count > 0 ? matchUps.OrderByDescending(x => x.Id).First().Id + 1 : 1;

            model.Id = currentId;
            matchUps.Add(model);

            foreach (MatchupEntryModel entry in model.Entries)
            {
                entry.SaveEntryToFile();
            }

            List <string> lines = new List <string>();

            // save to file
            foreach (MatchUpModel match in matchUps)
            {
                string winner = match.Winner?.Id.ToString();
                lines.Add($@"{match.Id},{CovertEntryModelToString(match.Entries)},{winner},{match.MatchUpRound}");
            }

            File.WriteAllLines(GlobalConfig.MatchUpFile.FullFileName(), lines);
        }
 private void LoadMatchups(MatchUpModel m)
 {
     for (int i = 0; i < m.Entries.Count; i++)
     {
         if (i == 0)
         {
             if (m.Entries[0].TeamCompeting != null)
             {
                 teamOneValue.Text      = m.Entries[0].TeamCompeting.TeamName;
                 scoreTeamOneValue.Text = m.Entries[0].Score.ToString();
                 teamTwoValue.Text      = "<bye>";
                 scoreTeamTwoValue.Text = "0";
             }
             else
             {
                 teamOneValue.Text      = "No Yet Set";
                 scoreTeamOneValue.Text = "";
             }
         }
         if (i == 1)
         {
             if (m.Entries[1].TeamCompeting != null)
             {
                 teamTwoValue.Text      = m.Entries[1].TeamCompeting.TeamName;
                 scoreTeamTwoValue.Text = m.Entries[1].Score.ToString();
             }
             else
             {
                 teamTwoValue.Text      = "No Yet Set";
                 scoreTeamTwoValue.Text = "";
             }
         }
     }
 }
Beispiel #3
0
        private static List <MatchUpModel> CreateFirstRound(int numberOfByes, List <TeamModel> teams)
        {
            List <MatchUpModel> output  = new List <MatchUpModel>();
            MatchUpModel        current = new MatchUpModel();

            foreach (var team in teams)
            {
                current.Entries.Add(new MatchupEntryModel {
                    TeamCompeting = team
                });

                if (numberOfByes > 0 || current.Entries.Count > 1)
                {
                    current.MatchUpRound = 1;
                    output.Add(current);
                    current = new MatchUpModel();

                    if (numberOfByes > 0)
                    {
                        numberOfByes--;
                    }
                }
            }

            return(output);
        }
        public static List <MatchUpModel> ConvertToMatchUpModels(this List <string> lines)
        {
            List <MatchUpModel> output = new List <MatchUpModel>();

            foreach (string line in lines)
            {
                string[] cols = line.Split(',');

                MatchUpModel mu = new MatchUpModel();
                mu.Id      = int.Parse(cols[0]);
                mu.Entries = ConvertStringToMatchUpEntryModels(cols[1]);

                if (cols[2].Length == 0)
                {
                    mu.Winner = null;
                }
                else
                {
                    mu.Winner = LookUpTeamById(int.Parse(cols[2]));
                }

                mu.MatchupRound = int.Parse(cols[3]);
                output.Add(mu);
            }
            return(output);
        }
Beispiel #5
0
        private void LoadMatchup(MatchUpModel m)
        {
            for (int i = 0; i < m.Entries.Count; i++)
            {
                if (i == 0)
                {
                    if (m.Entries[0].TeamCompeting != null)
                    {
                        TeamOneName.Text    = m.Entries[0].TeamCompeting.TeamName;
                        TeamOneTextBox.Text = m.Entries[0].Score.ToString();

                        TeamTowLabel.Text   = "<bye>";
                        TeamTowTextBox.Text = "0";
                    }
                    else
                    {
                        TeamOneName.Text       = "not yet set";
                        TeamOneScoreLable.Text = "";
                    }
                }
                if (i == 1)
                {
                    if (m.Entries[1].TeamCompeting != null)
                    {
                        TeamTowLabel.Text   = m.Entries[1].TeamCompeting.TeamName;
                        TeamTowTextBox.Text = m.Entries[1].Score.ToString();
                    }
                    else
                    {
                        TeamTowLabel.Text   = "not yet set";
                        TeamTowTextBox.Text = "";
                    }
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Save the matchups of tournament to file
        /// </summary>
        /// <param name="model"></param>
        public static void SaveMatchupToFile(this MatchUpModel model)
        {
            List <MatchUpModel> models = GlobalConfig.MatchupFile.FullFilePath().LoadFile().ConvertToMatchups();

            int curId = 1;

            if (models.Count > 0)
            {
                curId = models.OrderByDescending(x => x.id).First().id + 1;
            }

            model.id = curId;
            models.Add(model);

            foreach (MatchUpEntryModel entry in model.Entries)
            {
                entry.SaveEntryToFile();
            }

            List <string> lines = new List <string>();

            foreach (MatchUpModel m in models)
            {
                string winner = "";
                if (m.Winner != null)
                {
                    winner = m.Winner.id.ToString();
                }
                lines.Add($"{m.id},{m.Entries.ConvertMatchupEntryListToString()},{winner},{m.MatchUpRound}");
            }

            File.WriteAllLines(GlobalConfig.MatchupFile.FullFilePath(), lines);
        }
Beispiel #7
0
        public static void UpdateMatchUpToFile(this MatchUpModel matchup)
        {
            List <MatchUpModel> matchups   = GlobalConfig.MatchUpFile.FullFilePath().LoadFile().ConvertToMatchUpModels();
            MatchUpModel        oldMatchUp = new MatchUpModel();

            foreach (MatchUpModel m in matchups)
            {
                if (m.Id == matchup.Id)
                {
                    oldMatchUp = m;
                }
            }
            matchups.Remove(oldMatchUp);
            matchups.Add(matchup);
            foreach (MatchUpEntryModel entry in matchup.Entries)
            {
                entry.UpdateEntryToFile();
            }
            List <string> lines = new List <string>();

            foreach (MatchUpModel m in matchups)
            {
                string winner = "";
                if (m.Winner != null)
                {
                    winner = m.Winner.Id.ToString();
                }
                lines.Add($"{m.Id},{ConvertMatchUpEntryListToString(m.Entries)},{winner},{m.MatchUpRound}");
            }
            File.WriteAllLines(GlobalConfig.MatchUpFile.FullFilePath(), lines);
        }
        public static void SaveMatchUpToFile(this MatchUpModel matchUp)
        {
            List <MatchUpModel> matchUps = GlobalConfig.MatchUpFile.FullFilePath().LoadFile().ConvertToMatchUpModels();

            int currentId = 1;

            if (matchUps.Count > 0)
            {
                currentId = matchUps.OrderByDescending(x => x.Id).First().Id + 1;
            }

            matchUp.Id = currentId;

            matchUps.Add(matchUp);

            foreach (MatchUpEntryModel entry in matchUp.Entries)
            {
                entry.SaveEntryToFile(GlobalConfig.MatchUpEntryFile);
            }

            List <string> lines = new List <string>();

            foreach (MatchUpModel m in matchUps)
            {
                string winner = "";
                if (m.Winner != null)
                {
                    winner = m.Winner.Id.ToString();
                }
                lines.Add($"{ m.Id },{ ConvertMatchUpEntryListToString(m.Entries)},{ winner },{ m.MatchupRound }");
            }
            File.WriteAllLines(GlobalConfig.MatchUpFile.FullFilePath(), lines);
        }
Beispiel #9
0
        /// <summary>
        /// Update the matchup if needed
        /// </summary>
        /// <param name="m"></param>
        public void UpdateMatchup(MatchUpModel m)
        {
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(DataBase)))
            {
                var p = new DynamicParameters();
                if (m.Winner != null)
                {
                    p.Add("@id", m.id);
                    p.Add("@WinnerId", m.Winner.id);

                    connection.Execute("dbo.spMatchups_Update", p, commandType: CommandType.StoredProcedure);
                }

                foreach (MatchUpEntryModel entry in m.Entries)
                {
                    if (entry.TeamCompeting != null)
                    {
                        p = new DynamicParameters();
                        p.Add("@id", entry.id);
                        p.Add("@TeamCompetingId", entry.TeamCompeting.id);
                        p.Add("@Score", entry.Score);

                        connection.Execute("dbo.spMatchupEntries_Update", p, commandType: CommandType.StoredProcedure);
                    }
                }
            }
        }
Beispiel #10
0
        private static List <MatchUpModel> CreateFirstRound(int byes, List <TeamModel> teams)
        {
            List <MatchUpModel> output = new List <MatchUpModel>();
            MatchUpModel        curr   = new MatchUpModel();

            foreach (TeamModel team in teams)
            {
                curr.Entries.Add(new MatchUpEntryModel {
                    TeamCompeting = team
                });

                if (byes > 0 || curr.Entries.Count > 1)
                {
                    curr.MatchUpRound = 1;
                    output.Add(curr);
                    curr = new MatchUpModel();

                    if (byes > 0)
                    {
                        byes -= 1;
                    }
                }
            }

            return(output);
        }
        public void UpdateMatchUp(MatchUpModel model)
        {
            using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(TournamentDb)))
            {
                DynamicParameters p = new DynamicParameters();
                if (model.Winner != null)
                {
                    p.Add("@Id", model.Id);
                    p.Add("@WinnerId", model.Winner.Id);

                    connection.Execute("dbo.spMatchUps_Update", p, commandType: CommandType.StoredProcedure);
                }


                // spMatchUpEntries_Update id, TeamCompetingId, Score
                foreach (MatchupEntryModel me in model.Entries)
                {
                    if (me.TeamCompeting != null)
                    {
                        p = new DynamicParameters();

                        p.Add("@Id", me.Id);
                        p.Add("@TeamCompetingId", me.TeamCompeting.Id);
                        p.Add("@Score", me.Score);

                        connection.Execute("dbo.spMatchUpEntries_Update", p, commandType: CommandType.StoredProcedure);
                    }
                }
            }
        }
Beispiel #12
0
        private static void CreateOtherRounds(int rounds, TournamentModel model)
        {
            int round = 2;
            List <MatchUpModel> previousRound = model.Rounds[0];
            List <MatchUpModel> currRound     = new List <MatchUpModel>();
            MatchUpModel        currMatchUp   = new MatchUpModel();

            while (round <= rounds)
            {
                foreach (MatchUpModel match in previousRound)
                {
                    currMatchUp.Entries.Add(new MatchUpEntryModel {
                        ParentMatch = match
                    });
                    if (currMatchUp.Entries.Count > 1)
                    {
                        currMatchUp.MatchUpRound = round;
                        currRound.Add(currMatchUp);
                        currMatchUp = new MatchUpModel();
                    }
                }

                model.Rounds.Add(currRound);
                previousRound = currRound;

                currRound = new List <MatchUpModel>();
                round    += 1;
            }
        }
        /// <summary>
        /// Represent the matchup selected
        /// </summary>
        private void LoadMatchup()
        {
            MatchUpModel selectedMatchup = (MatchUpModel)matchupListBox.SelectedItem;

            if (selectedMatchup == null)
            {
                teamOneName.Text       = "Not Yet Set";
                teamOneScoreValue.Text = "";
                teamTwoName.Text       = "Not Yet Set";
                teamTwoScoreValue.Text = "";
                return;
            }

            for (int i = 0; i < selectedMatchup.Entries.Count; i++)
            {
                if (i == 0)
                {
                    if (selectedMatchup.Entries[0].TeamCompeting != null)
                    {
                        teamOneName.Text       = selectedMatchup.Entries[0].TeamCompeting.TeamName.Trim();
                        teamOneScoreValue.Text = selectedMatchup.Entries[0].Score.ToString();
                    }
                    else
                    {
                        teamOneName.Text       = "Not Yet Set";
                        teamOneScoreValue.Text = "";
                    }
                    continue;
                }
                else if (i == 1)
                {
                    if (selectedMatchup.Entries[1].TeamCompeting != null)
                    {
                        teamTwoName.Text       = selectedMatchup.Entries[1].TeamCompeting.TeamName.Trim();
                        teamTwoScoreValue.Text = selectedMatchup.Entries[1].Score.ToString();
                    }
                    else
                    {
                        teamTwoName.Text       = "Not Yet Set";
                        teamTwoScoreValue.Text = "";
                    }
                    return;
                }
            }

            teamTwoName.Text       = "<bye>";
            teamTwoScoreValue.Text = "";
        }
        private void scoreButton_Click(object sender, EventArgs e)
        {
            MatchUpModel m            = (MatchUpModel)matchuplistBox1.SelectedItem;
            double       teamOneScore = 0;
            double       teamTwoScore = 0;

            for (int i = 0; i < m.Entries.Count; i++)
            {
                if (i == 0)
                {
                    if (m.Entries[0].TeamCompeting != null)
                    {
                        bool scoreValid = double.TryParse(scoreTeamOneValue.Text, out teamOneScore);

                        if (scoreValid)
                        {
                            m.Entries[0].Score = teamOneScore;
                        }
                        else
                        {
                            MessageBox.Show("Please enter valid score for team 1");
                            return;
                        }
                    }
                }
                if (i == 1)
                {
                    if (m.Entries[1].TeamCompeting != null)
                    {
                        bool scoreValid = double.TryParse(scoreTeamTwoValue.Text, out teamTwoScore);

                        if (scoreValid)
                        {
                            m.Entries[1].Score = teamTwoScore;
                        }
                        else
                        {
                            MessageBox.Show("Please enter valid score for team 2");
                            return;
                        }
                    }
                }
            }
            TournamentLogic.UpdateTournamentResult(tournament);
            LoadMatchups((MatchUpModel)matchuplistBox1.SelectedItem);
            GlobalConfig.Connection.UpdateMatchup(m);
        }
Beispiel #15
0
        public static List <MatchUpModel> ConvertToMatchUpModels(this List <string> lines)
        {
            List <MatchUpModel> output = new List <MatchUpModel>();

            foreach (string line in lines)
            {
                string[]     cols = line.Split(',');
                MatchUpModel p    = new MatchUpModel();
                p.Id           = int.Parse(cols[0]);
                p.Entries      = ConvertStringToMatchUpEntryModels(cols[1]);
                p.Winner       = LookUpTeamById(int.Parse(cols[2]));
                p.MatchUpRound = int.Parse(cols[3]);

                output.Add(p);
            }
            return(output);
        }
Beispiel #16
0
        private void LoadMatchUp(MatchUpModel m)
        {
            if (m == null)
            {
                return;
            }

            for (int i = 0; i < m.Entries.Count; i++)
            {
                if (i == 0)
                {
                    if (m.Entries[0].TeamCompeting != null)
                    {
                        teamOneNameLabel.Text         = m.Entries[0].TeamCompeting.TeamName;
                        teamOneScoreValueTextBox.Text = m.Entries[0].Score.ToString();

                        teamTwoNameLabel.Text         = "<bye>";
                        teamTwoScoreValueTextBox.Text = "";
                    }
                    else
                    {
                        teamOneNameLabel.Text         = "Not set Yet";
                        teamOneScoreValueTextBox.Text = "";
                    }
                }

                if (i == 1)
                {
                    if (m.Entries[1].TeamCompeting != null)
                    {
                        teamTwoNameLabel.Text         = m.Entries[1].TeamCompeting.TeamName;
                        teamTwoScoreValueTextBox.Text = m.Entries[1].Score.ToString();
                    }
                    else
                    {
                        teamTwoNameLabel.Text         = "Not set Yet";
                        teamTwoScoreValueTextBox.Text = "";
                    }
                }
            }
        }
Beispiel #17
0
        /// <summary>
        /// Creates next rounds after the first one
        /// </summary>
        /// <param name="tournament"></param>
        /// <param name="rounds">Total number of rounds</param>
        private static void CreateOtherRounds(TournamentModel tournament, int rounds)
        {
            // Set next number of round, is 2
            int round = 2;

            // Previous round is the first element in a list
            // because it is the first round of a tournament
            List <MatchUpModel> previousRound = tournament.Rounds[0];

            // current match up will be added to the current list of matches of current round
            MatchUpModel currentMatchUp = new MatchUpModel();

            // List of matches in the current round
            List <MatchUpModel> currRound = new List <MatchUpModel>();

            while (round <= rounds)
            {
                // Loop through each game in a prev round
                foreach (MatchUpModel match in previousRound)
                {
                    currentMatchUp.Entries.Add(new MatchupEntryModel {
                        ParentMatchUp = match
                    });

                    if (currentMatchUp.Entries.Count > 1)
                    {
                        currentMatchUp.MatchUpRound = round;
                        currRound.Add(currentMatchUp);
                        currentMatchUp = new MatchUpModel();
                    }
                }

                round++;
                tournament.Rounds.Add(currRound);
                previousRound = currRound;

                currRound = new List <MatchUpModel>();
            }
        }
Beispiel #18
0
        /// <summary>
        /// Convert all the lines from the files to MatchupModel objects
        /// </summary>
        /// <param name="lines"></param>
        /// <returns>List of MatchupModels</returns>
        public static List <MatchUpModel> ConvertToMatchups(this List <string> lines)
        {
            List <MatchUpModel> output = new List <MatchUpModel>();

            foreach (string line in lines)
            {
                string[]     columns = line.Split(',');
                MatchUpModel model   = new MatchUpModel();
                model.id      = int.Parse(columns[0]);
                model.Entries = ConvertStringToMatchupEntryModels(columns[1]);
                if (columns[2].Length > 0)
                {
                    model.Winner = GetTeamById(columns[2]);
                }
                else
                {
                    model.Winner = null;
                }
                model.MatchUpRound = int.Parse(columns[3]);
                output.Add(model);
            }
            return(output);
        }
Beispiel #19
0
        public static List <MatchUpModel> ConvertToMatchUpModels(this List <string> lines)
        {
            //id=0,entries=1 (pipe delimited),winner=2,matchupround=3
            List <MatchUpModel> output = new List <MatchUpModel>();

            foreach (string line in lines)
            {
                string[] cols = line.Split(',');

                MatchUpModel current = new MatchUpModel
                {
                    Id           = int.Parse(cols[0]),
                    Entries      = ConvertStringToMatchUpEntryModels(cols[1]),
                    MatchUpRound = int.Parse(cols[3])
                };

                current.Winner = string.IsNullOrEmpty(cols[2]) ? null : LookUpTeamById(int.Parse(cols[2]));

                output.Add(current);
            }

            return(output);
        }
Beispiel #20
0
        public static void UpdateMatchUpToFile(this MatchUpModel model)
        {
            List <MatchUpModel> matchUps = GlobalConfig.MatchUpFile.FullFileName().LoadFile().ConvertToMatchUpModels();

            matchUps.RemoveAll(x => x.Id == model.Id);

            matchUps.Add(model);

            foreach (MatchupEntryModel entry in model.Entries)
            {
                entry.UpdateEntryToFile();
            }

            List <string> lines = new List <string>();

            // save to file
            foreach (MatchUpModel match in matchUps)
            {
                string winner = match.Winner?.Id.ToString();
                lines.Add($@"{match.Id},{CovertEntryModelToString(match.Entries)},{winner},{match.MatchUpRound}");
            }

            File.WriteAllLines(GlobalConfig.MatchUpFile.FullFileName(), lines);
        }
        private void scoreButton_Click(object sender, EventArgs e)
        {
            if (!IsValidData())
            {
                return;
            }

            MatchUpModel m = (MatchUpModel)matchupListBox.SelectedItem;

            m.Entries[0].Score = double.Parse(teamOneScoreValue.Text);
            m.Entries[1].Score = double.Parse(teamTwoScoreValue.Text);

            try
            {
                TournamentLogic.UpdateTournamentResult(tournament);
            }
            catch (Exception err)
            {
                MessageBox.Show($"The app had the following error:{err.Message}");
                return;
            }

            LoadMatchUps();
        }
Beispiel #22
0
 public void UpdateMatchUp(MatchUpModel model)
 {
     model.UpdateMatchUpToFile();
 }
 /// <summary>
 /// Update the info of the matchup
 /// </summary>
 /// <param name="m"></param>
 public void UpdateMatchup(MatchUpModel m)
 {
     m.UpdateMatchupToFile();
 }
Beispiel #24
0
        private void scoreButton_Click(object sender, EventArgs e)
        {
            MatchUpModel m = (MatchUpModel)matchupListBox.SelectedItem;
            double       teamOneScore = 0, teamTwoScore = 0;

            if (!IsValidData())
            {
                MessageBox.Show("You need to enter valid data before we can score this match up.");
                return;
            }

            for (int i = 0; i < m.Entries.Count; i++)
            {
                if (i == 0)
                {
                    if (m.Entries[0].TeamCompeting != null)
                    {
                        teamOneNameLabel.Text = m.Entries[0].TeamCompeting.TeamName;
                        bool scoreValid = double.TryParse(teamOneScoreValueTextBox.Text, out teamOneScore);

                        if (scoreValid)
                        {
                            m.Entries[0].Score = teamOneScore;
                        }
                        else
                        {
                            Helper.ShowMessage("Please enter the valid score value for team one", true);
                            return;
                        }
                    }
                }


                if (i == 1)
                {
                    if (m.Entries[1].TeamCompeting != null)
                    {
                        teamTwoNameLabel.Text = m.Entries[1].TeamCompeting.TeamName;
                        bool scoreValid = double.TryParse(teamTwoScoreValueTextBox.Text, out teamTwoScore);

                        if (scoreValid)
                        {
                            m.Entries[1].Score = teamTwoScore;
                        }
                        else
                        {
                            Helper.ShowMessage("Please enter the valid score value for team two", true);
                            return;
                        }
                    }
                }
            }

            try
            {
                TournamentLogic.UpdateTournamentResults(this._loadedTournament);
            }
            catch (Exception exception)
            {
                MessageBox.Show($@"The application had the following error: {exception.Message}");
                return;
            }

            this.LoadMatchUps((int)roundDropDown.SelectedItem);
        }
        protected override void Seed(Tournament.Models.TournamentContext context)
        {
            var Team1 = new TeamModel()
            {
                TeamId = 1, TeamName = "Manhatan", TeamMembers = new List <PersonModel>()
            };
            var Team2 = new TeamModel()
            {
                TeamId = 2, TeamName = "VP", TeamMembers = new List <PersonModel>()
            };
            var Team3 = new TeamModel()
            {
                TeamId = 3, TeamName = "Faze", TeamMembers = new List <PersonModel>()
            };
            var Team4 = new TeamModel()
            {
                TeamId = 4, TeamName = "123", TeamMembers = new List <PersonModel>()
            };
            var Team5 = new TeamModel()
            {
                TeamId = 5, TeamName = "432", TeamMembers = new List <PersonModel>()
            };
            var Team6 = new TeamModel()
            {
                TeamId = 6, TeamName = "asd", TeamMembers = new List <PersonModel>()
            };
            var Team7 = new TeamModel()
            {
                TeamId = 7, TeamName = "qwe", TeamMembers = new List <PersonModel>()
            };
            var Team8 = new TeamModel()
            {
                TeamId = 8, TeamName = "wer", TeamMembers = new List <PersonModel>()
            };
            var Person = new PersonModel()
            {
                PersonId = 1, Email = "*****@*****.**", NickName = "Raf", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person2 = new PersonModel()
            {
                PersonId = 2, Email = "*****@*****.**", NickName = "Raf2", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person3 = new PersonModel()
            {
                PersonId = 3, Email = "*****@*****.**", NickName = "baran2", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person4 = new PersonModel()
            {
                PersonId = 4, Email = "*****@*****.**", NickName = "baran3", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person5 = new PersonModel()
            {
                PersonId = 5, Email = "*****@*****.**", NickName = "qwe", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person6 = new PersonModel()
            {
                PersonId = 6, Email = "*****@*****.**", NickName = "qwe2", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person7 = new PersonModel()
            {
                PersonId = 7, Email = "*****@*****.**", NickName = "asd", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person8 = new PersonModel()
            {
                PersonId = 8, Email = "*****@*****.**", NickName = "asd2", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person9 = new PersonModel()
            {
                PersonId = 9, Email = "*****@*****.**", NickName = "zxc", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person10 = new PersonModel()
            {
                PersonId = 10, Email = "*****@*****.**", NickName = "zcx2", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person11 = new PersonModel()
            {
                PersonId = 11, Email = "*****@*****.**", NickName = "tyu2", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person12 = new PersonModel()
            {
                PersonId = 12, Email = "*****@*****.**", NickName = "tyu", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person13 = new PersonModel()
            {
                PersonId = 13, Email = "*****@*****.**", NickName = "iop", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person14 = new PersonModel()
            {
                PersonId = 14, Email = "*****@*****.**", NickName = "iop2", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person15 = new PersonModel()
            {
                PersonId = 15, Email = "*****@*****.**", NickName = "jkl", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };
            var Person16 = new PersonModel()
            {
                PersonId = 16, Email = "*****@*****.**", NickName = "jkl2", FirstName = "raffa", LastName = "daddo", Password = "******", ConfirmPassword = "******"
            };

            context.TournamentModels.Add(Person);
            context.TournamentModels.Add(Person2);
            context.TournamentModels.Add(Person3);
            context.TournamentModels.Add(Person4);
            context.TournamentModels.Add(Person5);
            context.TournamentModels.Add(Person6);
            context.TournamentModels.Add(Person7);
            context.TournamentModels.Add(Person8);
            context.TournamentModels.Add(Person9);
            context.TournamentModels.Add(Person10);
            context.TournamentModels.Add(Person11);
            context.TournamentModels.Add(Person12);
            context.TournamentModels.Add(Person13);
            context.TournamentModels.Add(Person14);
            context.TournamentModels.Add(Person15);
            context.TournamentModels.Add(Person16);

            context.Teams.Add(Team1);
            context.Teams.Add(Team2);
            context.Teams.Add(Team3);
            context.Teams.Add(Team4);
            context.Teams.Add(Team5);
            context.Teams.Add(Team6);
            context.Teams.Add(Team7);
            context.Teams.Add(Team8);

            Team1.TeamMembers.Add(Person);
            Team1.TeamMembers.Add(Person2);
            Team2.TeamMembers.Add(Person3);
            Team2.TeamMembers.Add(Person4);
            Team3.TeamMembers.Add(Person5);
            Team3.TeamMembers.Add(Person6);
            Team4.TeamMembers.Add(Person7);
            Team4.TeamMembers.Add(Person8);
            Team5.TeamMembers.Add(Person9);
            Team5.TeamMembers.Add(Person10);
            Team6.TeamMembers.Add(Person11);
            Team6.TeamMembers.Add(Person12);
            Team7.TeamMembers.Add(Person13);
            Team7.TeamMembers.Add(Person14);
            Team8.TeamMembers.Add(Person15);
            Team8.TeamMembers.Add(Person16);

            var matchup1 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team1, Score = 1
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team2, Score = 2
                    }
                }, MatchupRound = 3
            };
            var matchup2 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team1, Score = 2
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team3, Score = 1
                    }
                }, MatchupRound = 2
            };
            var matchup3 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team2, Score = 2
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team4, Score = 1
                    }
                }, MatchupRound = 2
            };
            var matchup4 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team1, Score = 2
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team5, Score = 1
                    }
                }, MatchupRound = 1
            };
            var matchup5 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team2, Score = 2
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team6, Score = 1
                    }
                }, MatchupRound = 1
            };
            var matchup6 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team3, Score = 2
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team7, Score = 1
                    }
                }, MatchupRound = 1
            };
            var matchup7 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team4, Score = 2
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team8, Score = 1
                    }
                }, MatchupRound = 1
            };

            context.Tournamets.Add(new TournamentModel
            {
                EnteredTeams = new List <TeamModel>
                {
                    Team1,
                    Team2,
                    Team3,
                    Team4,
                    Team5,
                    Team6,
                    Team7,
                    Team8,
                },
                EntryFee = 123,
                Prizes   = new List <PrizeModel>
                {
                    new PrizeModel
                    {
                        PlaceName   = "1",
                        PlaceNumber = 1,
                        PrizeAmount = 123
                    }
                },
                Rounds = new List <MatchUpModel>
                {
                    matchup1,
                    matchup2,
                    matchup3,
                    matchup4,
                    matchup5,
                    matchup6,
                    matchup7
                },
                TournamentName = "First Tournament"
            });
            var matchup8 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team6, Score = 1
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team7, Score = 2
                    }
                }, MatchupRound = 3
            };
            var matchup9 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team6, Score = 2
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team5, Score = 1
                    }
                }, MatchupRound = 2
            };
            var matchup10 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team8, Score = 1
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team7, Score = 2
                    }
                }, MatchupRound = 2
            };
            var matchup11 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team1, Score = 1
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team5, Score = 2
                    }
                }, MatchupRound = 1
            };
            var matchup12 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team2, Score = 1
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team6, Score = 2
                    }
                }, MatchupRound = 1
            };
            var matchup13 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team3, Score = 1
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team7, Score = 2
                    }
                }, MatchupRound = 1
            };
            var matchup14 = new MatchUpModel {
                Entries = new List <MatchUpEntryModel> {
                    new MatchUpEntryModel {
                        TeamCompeting = Team4, Score = 1
                    }, new MatchUpEntryModel {
                        TeamCompeting = Team8, Score = 2
                    }
                }, MatchupRound = 1
            };

            context.Tournamets.Add(new TournamentModel
            {
                EnteredTeams = new List <TeamModel>
                {
                    Team1,
                    Team2,
                    Team3,
                    Team4,
                    Team5,
                    Team6,
                    Team7,
                    Team8,
                },
                EntryFee = 2000,
                Prizes   = new List <PrizeModel>
                {
                    new PrizeModel
                    {
                        PlaceName   = "1",
                        PlaceNumber = 1,
                        PrizeAmount = 123
                    }
                },
                Rounds = new List <MatchUpModel>
                {
                    matchup8,
                    matchup9,
                    matchup10,
                    matchup11,
                    matchup12,
                    matchup13,
                    matchup14
                },
                TournamentName = "Second Tournament"
            });
        }