コード例 #1
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);
     }
 }
コード例 #2
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);
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
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);
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
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);
            }
        }
コード例 #7
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);
            }
        }
コード例 #8
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);
            }
        }