public GameDataModel SetRound(RoundDataModel round) { try { Round roundInstance = new Round { id = round.id, gameId = round.gameId, playerOneMoveId = round.playerOneMoveId, playerTwoMoveId = round.playerTwoMoveId, }; GameRepository.SetRound(roundInstance); GameRepository.getWinner(round.gameId); // get result var data = this.GetResult(round.gameId); return(data.FirstOrDefault()); } catch (Exception e) { Console.WriteLine(e); throw; } }
public IHttpActionResult setRound([FromBody] RoundDataModel round) { if (!ModelState.IsValid) { return(BadRequest("Please check the parameters")); } var gameInstance = Appservice.SetRound(round); if (gameInstance == null) { return(NotFound()); } return(Ok(gameInstance)); }