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(); }
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(); }
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(); }