public void Handle(GameCompletedEvent e) { foreach (var p in e.Placings) { var player = QueryDataStore.GetData <PlayerLookupDto>().Single(x => x.PlayerId == p.Key); var dto = QueryDataStore.GetData <GetGamePlayersDto>().Single(x => x.GameId == e.GameId && x.PlayerId == player.PlayerId); dto.Placing = p.Value; if (dto.Placing == 1) { dto.Winnings = e.First; } if (dto.Placing == 2) { dto.Winnings = e.Second; } if (dto.Placing == 3) { dto.Winnings = e.Third; } QueryDataStore.Update(dto); } }
public void Handle(GameUncompletedEvent e) { var dto = QueryDataStore.GetData <GameLookupDto>().Single(x => x.GameId == e.GameId); dto.Completed = false; QueryDataStore.Update(dto); }
public void Handle(GameDateChangedEvent e) { var dto = QueryDataStore.GetData <GameLookupDto>().Single(x => x.GameId == e.GameId); dto.GameDate = e.GameDate; QueryDataStore.Update(dto); }
public void Handle(GameUncompletedEvent e) { var dto = QueryDataStore.GetData <GetGamesListDto>().Single(); dto.Completed = false; QueryDataStore.Update(dto); }
public void Handle(RebuyRemovedEvent e) { var dto = QueryDataStore.GetData <GetGamePlayersDto>().Single(p => p.GameId == e.GameId && p.PlayerId == e.PlayerId); dto.PayIn -= 10; QueryDataStore.Update(dto); }
public void Handle(GameCompletedEvent e) { foreach (var player in e.Placings) { var dto = QueryDataStore.GetData <GetPlayersDto>().Single(p => p.PlayerId == player.Key); dto.GamesPlayed++; QueryDataStore.Update(dto); } }
public void Handle(RebuyAddedEvent e) { var dto = QueryDataStore.GetData <GetGamePlayersDto>().Single(p => p.GameId == e.GameId && p.PlayerId == e.PlayerId); dto.PayIn += e.RebuyAmount; dto.Rebuys++; QueryDataStore.Update(dto); }
public void Handle(GameUncompletedEvent e) { // How does this Single even work, shouldn't we need to filter by GameId // should probably write a test for this first var dto = QueryDataStore.GetData <GetGamesListDto>().Single(); dto.Completed = false; QueryDataStore.Update(dto); }
public void Handle(GameDateChangedEvent e) { var dto = QueryDataStore.GetData <GetGameCountByDateDto>().Single(x => x.GameId == e.GameId); dto.GameYear = e.GameDate.Year; dto.GameMonth = e.GameDate.Month; dto.GameDay = e.GameDate.Day; QueryDataStore.Update <GetGameCountByDateDto>(dto); }
public void Handle(GameUncompletedEvent e) { var gamePlayersDto = QueryDataStore.GetData <GamePlayersLookupDto>().Where(x => x.GameId == e.GameId).ToList(); foreach (var player in gamePlayersDto) { var dto = QueryDataStore.GetData <GetPlayersDto>().Single(x => x.PlayerId == player.PlayerId); dto.GamesPlayed--; QueryDataStore.Update(dto); } }
public void Handle(GameCompletedEvent e) { var winnerId = e.Placings.Single(p => p.Value == 1).Key; var winner = QueryDataStore.GetData <PlayerLookupDto>().Single(p => p.PlayerId == winnerId); var game = QueryDataStore.GetData <GetGamesListDto>().Single(g => g.GameId == e.GameId); var dto = new GetGamesListDto() { DtoId = game.DtoId, GameId = e.GameId, GameDate = game.GameDate, Winner = winner.PlayerName, Winnings = e.First, Completed = true, }; QueryDataStore.Update(dto); }