Ejemplo n.º 1
0
        private void Handle(GuessMade e)
        {
            GuessReadModel guessRM = new GuessReadModel()
            {
                GameId = e.GameId, GuessStatus = "unknown", Guess = e.Guess, Id = e.GuessId, Level = e.Level, GuessTime = DateTime.UtcNow
            };

            this._context.Guesses.Add(guessRM);
            this._context.SaveChanges();
        }
Ejemplo n.º 2
0
        private void Handle(LevelFailed e)
        {
            GameReadModel grm = this._context.Games.FirstOrDefault(game => game.Id == e.Id);

            grm.Score = e.NewScore;

            GuessReadModel sourceGuess = this._context.Guesses.FirstOrDefault(g => g.Id == e.GuessId && g.GuessStatus == "unknown");

            sourceGuess.GuessStatus = "wrong";

            this._context.SaveChanges();
        }
Ejemplo n.º 3
0
        private void Handle(LevelSucceeded e)
        {
            GameReadModel grm = this._context.Games.FirstOrDefault(game => game.Id == e.Id);

            grm.Level    = e.NewLevel;
            grm.Score    = e.NewScore;
            grm.Question = _riddleRepository.GetRiddle(e.NewLevel).Question;

            GuessReadModel sourceGuess = this._context.Guesses.FirstOrDefault(g => g.Id == e.GuessId && g.GuessStatus == "unknown");

            sourceGuess.GuessStatus = "correct";

            this._context.SaveChanges();
        }