public DisplayHangmanGame(SimpleHangmanDTO hangmanGameDTO) { GameId = hangmanGameDTO.GameId; Word = hangmanGameDTO.Word.ToUpper(); SetupGuesses(hangmanGameDTO.Guesses.ToList()); CreateEncodeWord(); }
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); }
public ActionResult UpdateHangmanGame([FromBody] SimpleHangmanDTO dto) { return(Ok(GameService.UpdateHangman(dto))); }