Exemplo n.º 1
0
        public void setConfigurations()
        {
            List <Configurations> configs = new List <Configurations>();

            configs.Add(new Configurations
            {
                ConfigurationsId       = 1,
                MaxAllRoundersAllowed  = 2,
                MaxBatsmensAllowed     = 5,
                MaxBowlersAllowed      = 4,
                MaxExtraPlayersAllowed = 3
            });

            configs.Add(new Configurations
            {
                ConfigurationsId       = 2,
                MaxAllRoundersAllowed  = 2,
                MaxBatsmensAllowed     = 5,
                MaxBowlersAllowed      = 4,
                MaxExtraPlayersAllowed = 3
            });

            foreach (var item in configs)
            {
                Repository.Insert(item);
            }
            Repository.SaveAllChanges();
        }
Exemplo n.º 2
0
        public Team_DL CreateTeam(Team_DL teamDL)
        {
            List <Player> players = new List <Player>();

            foreach (var item in teamDL.Players)
            {
                players.Add(new Player {
                    Gender = item.Gender, Id = item.Id, Name = item.Name, TeamId = item.TeamId
                });
            }

            Team team = new Team {
                JerseyColor = teamDL.JerseyColor, Players = players,
                TeamName    = teamDL.TeamName, TournmentCode = teamDL.TournmentCode
            };

            Repository.Insert(team);
            Repository.SaveAllChanges();
            teamDL.TeamId = team.TeamId;
            return(teamDL);
        }
Exemplo n.º 3
0
        public List <Tournament_DL> CreateTournaments()
        {
            List <Tournment> tournments = new List <Tournment>();

            tournments.Add(new Tournment
            {
                Name            = "IPL League",
                TournmentCode   = "IPL2021",
                ConfigurationId = 1,
                Teams           = null
            });

            tournments.Add(new Tournment
            {
                Name            = "PRO League",
                TournmentCode   = "PRO2021",
                ConfigurationId = 1,
                Teams           = null
            });


            List <Tournament_DL> tournament_DLs = new List <Tournament_DL>();


            foreach (var item in tournments)
            {
                Repository.Insert(item);

                tournament_DLs.Add(new Tournament_DL
                {
                    ConfigurationId = item.ConfigurationId,
                    Name            = item.Name,
                    TournmentCode   = item.TournmentCode
                });
            }
            Repository.SaveAllChanges();
            getTournments();
            return(tournament_DLs);
        }