コード例 #1
0
 public IEnumerable<Shot> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return context.Shots.ToList();
     }
 }
コード例 #2
0
 public IEnumerable<PlayerCareerStatistics> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return context.PlayerCareerStatistics.Include(pcs => pcs.Player).ToList();
     }
 }
コード例 #3
0
 public IEnumerable <Hole> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return(context.Holes.ToList());
     }
 }
コード例 #4
0
 public IEnumerable<GameStatistics> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return context.GameStatistics.ToList();
     }
 }
コード例 #5
0
 public void DeleteAll()
 {
     using (var context = new BolfTrackerContext())
     {
         context.Database.ExecuteSqlCommand("DELETE FROM PlayerCareerStatistics");
     }
 }
コード例 #6
0
 public void DeleteAll()
 {
     using (var context = new BolfTrackerContext())
     {
         context.Database.ExecuteSqlCommand("DELETE FROM PlayerCareerStatistics");
     }
 }
コード例 #7
0
 public IEnumerable<Player> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return context.Players.ToList();
     }
 }
コード例 #8
0
 public IEnumerable <PlayerCareerStatistics> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return(context.PlayerCareerStatistics.Include(pcs => pcs.Player).ToList());
     }
 }
コード例 #9
0
 public IEnumerable <PlayerHoleStatistics> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return(context.PlayerHoleStatistics.ToList());
     }
 }
コード例 #10
0
 public IEnumerable<Hole> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return context.Holes.ToList();
     }
 }
コード例 #11
0
 public void DeleteByMonthAndYear(int month, int year)
 {
     using (var context = new BolfTrackerContext())
     {
         context.Database.ExecuteSqlCommand("DELETE FROM HoleStatistics WHERE Month = @Month AND Year = @Year", new SqlParameter { ParameterName = "Month", Value = month }, new SqlParameter { ParameterName = "Year", Value = year });
     }
 }
コード例 #12
0
 public IEnumerable <Shot> All()
 {
     using (var context = new BolfTrackerContext())
     {
         return(context.Shots.ToList());
     }
 }
コード例 #13
0
 public void Delete(Hole model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.Holes.Remove(model);
         context.SaveChanges();
     }
 }
コード例 #14
0
 public void Delete(Hole model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.Holes.Remove(model);
         context.SaveChanges();
     }
 }
コード例 #15
0
 public void Delete(GameStatistics model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.GameStatistics.Remove(model);
         context.SaveChanges();
     }
 }
コード例 #16
0
 public void Update(Player player)
 {
     using (var context = new BolfTrackerContext())
     {
         context.Entry<Player>(player).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #17
0
 public void Update(Player player)
 {
     using (var context = new BolfTrackerContext())
     {
         context.Entry <Player>(player).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #18
0
 public void Delete(PlayerHoleStatistics model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.PlayerHoleStatistics.Remove(model);
         context.SaveChanges();
     }
 }
コード例 #19
0
        public Player GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var ranking = context.Players.SingleOrDefault(r => r.Id == id);

                return ranking;
            }
        }
コード例 #20
0
        public IEnumerable <Ranking> GetByMonthAndYear(int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var rankings = context.Rankings.Include(ranking => ranking.Player).Where(ranking => ranking.Month == month && ranking.Year == year).ToList();

                return(rankings);
            }
        }
コード例 #21
0
        public PlayerGameStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerGameStatistics = context.PlayerGameStatistics.SingleOrDefault(pgs => pgs.Id == id);

                return playerGameStatistics;
            }
        }
コード例 #22
0
        public IEnumerable <PlayerGameStatistics> All()
        {
            using (var context = new BolfTrackerContext())
            {
                var playerGameStatistics = context.PlayerGameStatistics.ToList();

                return(playerGameStatistics);
            }
        }
コード例 #23
0
        public PlayerCareerStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var query = context.PlayerCareerStatistics.SingleOrDefault(pcs => pcs.Id == id);

                return(query);
            }
        }
コード例 #24
0
        public IEnumerable <PlayerHoleStatistics> GetByMonthAndYear(int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerHoleStatistics = context.PlayerHoleStatistics.Include(phs => phs.Player).Include(phs => phs.Hole).Where(phs => phs.Month == month && phs.Year == year).ToList();

                return(playerHoleStatistics);
            }
        }
コード例 #25
0
 public void Add(Hole model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.Holes.Attach(model);
         context.Entry(model).State = EntityState.Added;
         context.SaveChanges();
     }
 }
コード例 #26
0
 public void Add(Shot shot)
 {
     using (var context = new BolfTrackerContext())
     {
         context.Shots.Attach(shot);
         context.Entry(shot).State = EntityState.Added;
         context.SaveChanges();
     }
 }
コード例 #27
0
        public IEnumerable <Player> GetByGame(int gameId)
        {
            using (var context = new BolfTrackerContext())
            {
                var players = context.Shots.Where(shot => shot.Game.Id == gameId).Select(shot => shot.Player).Distinct().ToList();

                return(players);
            }
        }
コード例 #28
0
        public Player GetByName(string name)
        {
            using (var context = new BolfTrackerContext())
            {
                var player = context.Players.First(p => p.Name == name);

                return(player);
            }
        }
コード例 #29
0
        public Player GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var ranking = context.Players.SingleOrDefault(r => r.Id == id);

                return(ranking);
            }
        }
コード例 #30
0
        public ShotType GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var shotType = context.ShotTypes.SingleOrDefault(st => st.Id == id);

                return shotType;
            }
        }
コード例 #31
0
        public PlayerHoleStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerHoleStatistics = context.PlayerHoleStatistics.SingleOrDefault(phs => phs.Id == id);

                return(playerHoleStatistics);
            }
        }
コード例 #32
0
        public IEnumerable<Shot> GetByGameAndPlayer(int gameId, int playerId)
        {
            using (var context = new BolfTrackerContext())
            {
                var shots = context.Shots.Include(shot => shot.ShotType).Include(shot => shot.Hole).Include(shot => shot.Player).Include(shot => shot.Game).Where(shot => shot.Game.Id == gameId && shot.Player.Id == playerId).ToList();

                return shots;
            }
        }
コード例 #33
0
        public Shot GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var shot = context.Shots.Include(s => s.ShotType).Include(s => s.Hole).Include(s => s.Player).Include(s => s.Game).SingleOrDefault(s => s.Id == id);

                return shot;
            }
        }
コード例 #34
0
        public IEnumerable <Hole> GetActiveByMonthAndYear(int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var holes = context.Shots.Where(shot => shot.Game.Date.Month == month && shot.Game.Date.Year == year).Select(shot => shot.Hole).Include(hole => hole.Shots.Where(shot => shot.Game.Date.Month == month && shot.Game.Date.Year == year)).Distinct().ToList();

                return(holes);
            }
        }
コード例 #35
0
        public IEnumerable<HoleStatistics> GetByMonthAndYear(int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var holeStatistics = context.HoleStatistics.Include(hs => hs.Hole).Where(hs => hs.Month == month && hs.Year == year).ToList();

                return holeStatistics;
            }
        }
コード例 #36
0
        public Hole GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var hole = context.Holes.SingleOrDefault(g => g.Id == id);

                return(hole);
            }
        }
コード例 #37
0
        public IEnumerable<PlayerGameStatistics> All()
        {
            using (var context = new BolfTrackerContext())
            {
                var playerGameStatistics = context.PlayerGameStatistics.ToList();

                return playerGameStatistics;
            }
        }
コード例 #38
0
        public PlayerCareerStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var query = context.PlayerCareerStatistics.SingleOrDefault(pcs => pcs.Id == id);

                return query;
            }
        }
コード例 #39
0
        public IEnumerable <Ranking> All()
        {
            using (var context = new BolfTrackerContext())
            {
                var rankings = context.Rankings.ToList();

                return(rankings);
            }
        }
コード例 #40
0
        public IEnumerable<Hole> GetActiveByMonthAndYear(int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var holes = context.Shots.Where(shot => shot.Game.Date.Month == month && shot.Game.Date.Year == year).Select(shot => shot.Hole).Include(hole => hole.Shots.Where(shot => shot.Game.Date.Month == month && shot.Game.Date.Year == year)).Distinct().ToList();

                return holes;
            }
        }
コード例 #41
0
        public GameStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var gameStatistic = context.GameStatistics.SingleOrDefault(gs => gs.Id == id);

                return gameStatistic;
            }
        }
コード例 #42
0
 public void Add(PlayerRivalryStatistics model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.PlayerRivalryStatistics.Attach(model);
         context.Entry(model).State = EntityState.Added;
         context.SaveChanges();
     }
 }
コード例 #43
0
        public IEnumerable<Player> GetByGame(int gameId)
        {
            using (var context = new BolfTrackerContext())
            {
                var players = context.Shots.Where(shot => shot.Game.Id == gameId).Select(shot => shot.Player).Distinct().ToList();

                return players;
            }
        }
コード例 #44
0
        public IEnumerable<PlayerHoleStatistics> GetByPlayerMonthAndYear(int playerId, int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerHoleStatistics = context.PlayerHoleStatistics.Include(phs => phs.Player).Include(phs => phs.Hole).Where(phs => phs.Player.Id == playerId && phs.Month == month && phs.Year == year).ToList();

                return playerHoleStatistics;
            }
        }
コード例 #45
0
        public Player GetByName(string name)
        {
            using (var context = new BolfTrackerContext())
            {
                var player = context.Players.First(p => p.Name == name);

                return player;
            }
        }
コード例 #46
0
        public GameStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var gameStatistic = context.GameStatistics.Include(gs => gs.Game).SingleOrDefault(gs => gs.Id == id);

                return(gameStatistic);
            }
        }
コード例 #47
0
        public HoleStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var holeStatistic = context.HoleStatistics.SingleOrDefault(hs => hs.Id == id);

                return(holeStatistic);
            }
        }
コード例 #48
0
 public void Delete(GameStatistics model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.GameStatistics.Attach(model);
         context.GameStatistics.Remove(model);
         context.SaveChanges();
     }
 }
コード例 #49
0
        public PlayerHoleStatistics GetByPlayerHoleMonthAndYear(int playerId, int holeId, int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerHoleStatistics = context.PlayerHoleStatistics.Include(phs => phs.Player).Include(phs => phs.Hole).First(phs => phs.Player.Id == playerId && phs.Hole.Id == holeId && phs.Month == month && phs.Year == year);

                return(playerHoleStatistics);
            }
        }
コード例 #50
0
        public PlayerGameStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerGameStatistics = context.PlayerGameStatistics.Include(pgs => pgs.Game).SingleOrDefault(pgs => pgs.Id == id);

                return(playerGameStatistics);
            }
        }
コード例 #51
0
        public PlayerCareerStatistics GetByPlayer(int playerId)
        {
            using (var context = new BolfTrackerContext())
            {
                var query = context.PlayerCareerStatistics.Include(pcs => pcs.Player).FirstOrDefault(pcs => pcs.Player.Id == playerId);

                return(query);
            }
        }
コード例 #52
0
        public IEnumerable <PlayerGameStatistics> GetByPlayer(int playerId)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerGameStatistics = context.PlayerGameStatistics.Include(pgs => pgs.Player).Include(pgs => pgs.Game).Where(pgs => pgs.Player.Id == playerId).ToList();

                return(playerGameStatistics);
            }
        }
コード例 #53
0
 public void Add(Hole model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.Holes.Attach(model);
         context.Entry(model).State = EntityState.Added;
         context.SaveChanges();
     }
 }
コード例 #54
0
        public IEnumerable <PlayerGameStatistics> GetByPlayerMonthAndYear(int playerId, int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerGameStatistics = context.PlayerGameStatistics.Include(pgs => pgs.Player).Include(pgs => pgs.Game).Where(pgs => pgs.Player.Id == playerId && pgs.Game.Date.Month == month && pgs.Game.Date.Year == year).ToList();

                return(playerGameStatistics);
            }
        }
コード例 #55
0
        public PlayerCareerStatistics GetByPlayer(int playerId)
        {
            using (var context = new BolfTrackerContext())
            {
                var query = context.PlayerCareerStatistics.Include(pcs => pcs.Player).FirstOrDefault(pcs => pcs.Player.Id == playerId);

                return query;
            }
        }
コード例 #56
0
        public HoleStatistics GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var holeStatistic = context.HoleStatistics.SingleOrDefault(hs => hs.Id == id);

                return holeStatistic;
            }
        }
コード例 #57
0
        public Hole GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var hole = context.Holes.SingleOrDefault(g => g.Id == id);

                return hole;
            }
        }
コード例 #58
0
        public PlayerStatistics GetByPlayerMonthAndYear(int playerId, int month, int year)
        {
            using (var context = new BolfTrackerContext())
            {
                var playerStatistics = context.PlayerStatistics.Include(ps => ps.Player).SingleOrDefault(ps => ps.Player.Id == playerId && ps.Month == month && ps.Year == year);

                return(playerStatistics);
            }
        }
コード例 #59
0
 public void Add(PlayerRivalryStatistics model)
 {
     using (var context = new BolfTrackerContext())
     {
         context.PlayerRivalryStatistics.Attach(model);
         context.Entry(model).State = EntityState.Added;
         context.SaveChanges();
     }
 }
コード例 #60
0
        public Game GetById(int id)
        {
            using (var context = new BolfTrackerContext())
            {
                var game = context.Games.Include(g => g.GameStatistics).SingleOrDefault(g => g.Id == id);

                return game;
            }
        }