Example #1
0
        public Player selectPlayerByUsername(string username)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                var player = db.Players.FirstOrDefault(x => x.Name == username);

                return(player);
            }
        }
Example #2
0
        public List <Player> getPlayers()
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                var players = db.Players.ToList();

                return(players);
            }
        }
Example #3
0
        public Player getPlayer(int playerId)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                var player = db.Players.FirstOrDefault(x => x.Id == playerId);

                return(player);
            }
        }
Example #4
0
        public void editPlayerUsername(int playerId, string newUsername)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                var player = db.Players.FirstOrDefault(x => x.Id == playerId);

                player.Name = newUsername;
                db.SaveChanges();
            }
        }
Example #5
0
        public void deletePlayer(int playerId)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                var player = db.Players.FirstOrDefault(x => x.Id == playerId);

                db.Remove(player);
                db.SaveChanges();
            }
        }
Example #6
0
        public List <Season> getSeasons()
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                List <Season> seasons = db.Seasons.ToList();


                return(seasons);
            }
        }
Example #7
0
        public List <League> GetLeagues()
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                List <League> leagues = db.Leagues.ToList();


                return(leagues);
            }
        }
Example #8
0
 public Choice MakeChoice(bool isSelected, string optionName)
 {
     using (var db = new PickAndStick.Models.PickerContext())
     {
         Choice choice = new Choice {
             IsSelected = isSelected, OptionName = optionName
         };
         db.Add(choice);
         db.SaveChanges();
         return(choice);
     }
 }
Example #9
0
        public WeekPick MakeWeekPick(int playerId, int seasonId)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                WeekPick weekPick = new WeekPick {
                    PlayerId = playerId, SeasonId = seasonId
                };
                db.Add(weekPick);
                db.SaveChanges();

                return(weekPick);
            }
        }
Example #10
0
        public Pick MakePick(List <Choice> choices, int weekPickId, int confidence)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                Pick pick = new Pick {
                    Choices = choices, WeekPickId = weekPickId, Confidence = confidence
                };
                db.Add(pick);
                db.SaveChanges();

                return(pick);
            }
        }
Example #11
0
        public Player makePlayer(string playerName, string playerEmail, string playerPassword)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                Player player = new Player {
                    Name = playerName, Email = playerEmail, Password = playerPassword
                };
                db.Add(player);
                db.SaveChanges();

                return(player);
            }
        }
Example #12
0
        public LeaguePlayer makeLeaguePlayer(int PlayerID, int LeagueID)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                LeaguePlayer newLeaguePlayer = new LeaguePlayer {
                    PlayerId = PlayerID, LeagueId = LeagueID
                };

                db.Add(newLeaguePlayer);
                db.SaveChanges();

                return(newLeaguePlayer);
            }
        }
Example #13
0
        public PlayerSeason makePlayerSeason(int seasonId, int playerId)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                PlayerSeason playerSeason = new PlayerSeason {
                    SeasonId = seasonId, PlayerId = playerId
                };

                db.Add(playerSeason);
                db.SaveChanges();

                return(playerSeason);
            }
        }
Example #14
0
        public Season makeSeason(int leagueId)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                Season season = new Season {
                    LeagueId = leagueId
                };

                db.Add(season);
                db.SaveChanges();

                return(season);
            }
        }
Example #15
0
        public League makeLeague(string name)
        {
            using (var db = new PickAndStick.Models.PickerContext())
            {
                League newLeague = new League {
                    Name = name
                };

                db.Add(newLeague);
                db.SaveChanges();

                return(newLeague);
            }
        }