예제 #1
0
 public DisplayHangmanGame(SimpleHangmanDTO hangmanGameDTO)
 {
     GameId = hangmanGameDTO.GameId;
     Word   = hangmanGameDTO.Word.ToUpper();
     SetupGuesses(hangmanGameDTO.Guesses.ToList());
     CreateEncodeWord();
 }
예제 #2
0
        public bool UpdateHangman(SimpleHangmanDTO dto)
        {
            var game = (HangmanGame)games
                       .Include(g => g.GamePair).ThenInclude(g => g.FirstGame).ThenInclude(g => g.Player)
                       .Include(g => g.GamePair).ThenInclude(g => g.FirstGame).ThenInclude(gg => (gg as HangmanGame).Guesses)
                       .Include(g => g.GamePair).ThenInclude(g => g.SecondGame).ThenInclude(g => g.Player)
                       .Include(g => g.GamePair).ThenInclude(g => g.SecondGame).ThenInclude(gg => (gg as HangmanGame).Guesses)
                       .Include(g => g.Player)
                       .SingleOrDefault(s => s.GameId == dto.GameId) ?? throw new ArgumentException();

            game.UpdateGuesses(dto.Guesses.ToList());
            game.Evaluate();
            games.Update(game);
            context.SaveChanges();
            return(true);
        }
예제 #3
0
 public ActionResult UpdateHangmanGame([FromBody] SimpleHangmanDTO dto)
 {
     return(Ok(GameService.UpdateHangman(dto)));
 }