public IHttpActionResult MakeMove([FromBody] Board board) { String result = ""; try { if (this.ModelState.IsValid) { DataAccess access = new DataAccess(); access.MakeMove(board); if (UtilGame.checkWin(board.Moves)) { access.AddWinner(board.GameCode, board.PlayerId); result = "Congratulations you won in the board(" + board.BoardId + ")"; } else { result = "You have successfully made your move in the board(" + board.BoardId + ")"; } } else { result = " if Making move has error"; } } catch (Exception e) { result = "Making move has error"; } return(CreatedAtRoute("DefaultApi", new { id = 1 }, result)); }
public Boolean PostMakeMove([FromBody] Board board) { Boolean result = false; try { if (this.ModelState.IsValid) { DataAccess access = new DataAccess(); access.MakeMove(board); if (UtilGame.checkWin(board.Moves)) { access.AddWinner(board.GameCode, board.PlayerId); result = true; } } } catch (Exception e) { } return(result); }