public object Post([FromBody] IshitoriGameModel model) { _model = model; _currentGame = new IshitoriGame(_model, new int[] { }); _currentGame.CalculateNextTurn(); _currentGame.IsGameFinished(); return(model); }
public object Post([FromBody] CreateGameModel GameToCreate) { Array.Sort(GameToCreate.GameInterval); object game = new object(); if (GameToCreate.SelectedGame == "Ishitori" && GameToCreate.GameInterval.Count() == 2) { IshitoriGame newGame = new IshitoriGame(_model, GameToCreate.GameInterval); game = _model; } else if (GameToCreate.SelectedGame == "GuessTheNumber" && GameToCreate.GameInterval.Count() == 2) { GuessTheNumberGame newGame = new GuessTheNumberGame(_modelGuess, GameToCreate.GameInterval); game = _modelGuess; } else { return(BadRequest()); } return(game); }