//// GET: api/Games //public IEnumerable<string> Get() //{ // return new string[] { "value1", "value2" }; //} //// GET: api/Games/5 //public string Get(int id) //{ // return "value"; //} // POST: api/Games public IHttpActionResult Post(PostNewGame game) { //Create a game string newGamePin = gameManager.CreateNewGame(game.GameName); //Return game pin return(Ok <string>(newGamePin)); }
public ActionResult Create(PostNewGame postNewGame) { string gamePin = gameRoomManagement.CreateNewGameRoom(postNewGame); if (gamePin != null) { return(RedirectToAction("Index", new { id = gamePin })); } else { return(RedirectToAction("CreateGame")); } }
public string AddNewGame(PostNewGame postNewGame) { var request = new RestRequest(null, DataFormat.Json); tokenAdmin.AddServiceTokenToRestRequest(request); request.AddJsonBody(postNewGame); var restResponse = restClient.Post <string>(request); string gamePin; if (restResponse.IsSuccessful) { gamePin = restResponse.Data; } else { gamePin = null; } return(gamePin); }
public string CreateNewGameRoom(PostNewGame postNewGame) { return(gameRoomRepository.AddNewGame(postNewGame)); }