public GamePanelViewModel(Game game, IEnumerable<Shot> shots, IEnumerable<Player> allPlayers, IEnumerable<Hole> allHoles) { Game = game; Shots = shots; _allPlayers = allPlayers; _allHoles = allHoles; }
public GamePanelViewModel(Game game, IEnumerable<ShotType> scoreTypes, IEnumerable<Player> allPlayers, IEnumerable<Hole> allHoles) { Game = game; _allPlayers = allPlayers; _allHoles = allHoles; _scoreTypes = scoreTypes; }
public void Delete(Game model) { using (var context = new BolfTrackerContext()) { context.Games.Remove(model); context.SaveChanges(); } }
public Game CreateGame(DateTime date) { var game = new Game() { Date = date }; _gameRepository.Add(game); _unitOfWork.Commit(); return game; }
public void Add(Game model) { using (var context = new BolfTrackerContext()) { context.Games.Attach(model); context.Entry(model).State = EntityState.Added; context.SaveChanges(); } }
public static PlayerRivalryStatistics CreatePlayerRivalryStatistics(Game game, Player player, Player affectedPlayer, Hole hole, ShotType shotType) { return new PlayerRivalryStatistics { Game = game, Player = player, AffectedPlayer = affectedPlayer, Hole = hole, ShotType = shotType, Attempts = 10, Points = 5 }; }
public static GameStatistics CreateGameStatistics(Game game) { return new GameStatistics { Game = game, HoleCount = 10, PlayerCount = 9, Points = 8, ShotsMade = 7, ShotsMissed = 6, Attempts = 5, Pushes = 4, Steals = 3, SugarFreeSteals = 2, StainlessSteals = 1, OvertimeCount = 0, ShootingPercentage = 0.234M }; }
public static PlayerGameStatistics CreatePlayerGameStatistics(Game game, Player player) { return new PlayerGameStatistics { Game = game, Player = player, Points = 8, Winner = true, OvertimeWin = false, ShotsMade = 7, Attempts = 5, ShootingPercentage = 0.234M, Pushes = 4, Steals = 3, SugarFreeSteals = 2, StainlessSteals = 1, GameWinningSteal = false, Shutout = true, PerfectGame = false }; }
public LeaderboardViewModel(Player player, IEnumerable<Shot> playerShots, Game game, IEnumerable<Shot> shots) { Player = player; Points = playerShots.Where(s => s.ShotType.Id != ShotTypePush).Sum(s => s.Points); ShotsMade = playerShots.Count(s => s.ShotMade); Attempts = playerShots.Sum(s => s.Attempts); ShootingPercentage = Decimal.Round(Convert.ToDecimal(ShotsMade) / Convert.ToDecimal(Attempts), 2, MidpointRounding.AwayFromZero); Steals = shots.Count(s => s.Player.Id == player.Id && (s.ShotType.Id == 4 || s.ShotType.Id == 5)); Pushes = shots.Count(s => s.Player.Id == player.Id && s.ShotType.Id == 3); }
public Game CreateGame(DateTime date) { var game = new Game() { Date = date }; _gameRepository.Add(game); return game; }
public static Shot CreateShot(Game game, Player player, ShotType shotType, Hole hole) { return new Shot { Game = game, Player = player, ShotType = shotType, Hole = hole, ShotMade = true, Attempts = 1, Points = 10 }; }
public HoleViewModel(Game game) { var holes = (from s in game.Shots select s.Hole).Distinct(); Holes = holes; }