public ActionResult MultiplayerGameForm(MultiplayerGameModel model) { try { if (ModelState.IsValid) { ModelState.Clear(); model = game.SetMultiplayerGameModelForNewTurn(model, AuthorizedUserId); if (model.RivalPlayer == null) { ViewBag.Message = Resources.waitForOtherPlayer; } return(PartialView("_MultiplayerGame", model)); } else { return(PartialView("_MultiplayerGame", model)); } } catch (Exception ex) { if (model.RivalPlayer == null) { ViewBag.Message = Resources.waitForOtherPlayer; return(PartialView("_MultiplayerGame", model)); } game.DeleteCurrentGame(model.HostPlayer.UserName); return(RedirectToAction("Index")); } }
public ActionResult _MultiplayerGame(string userName) { try { MultiplayerGameModel model = game.GetHostGameByUserName(userName, AuthorizedUserId); model.RivalPlayer = new PlayerModel() { UserName = AuthorizedUserId, ImagePath = model.HostPlayer.ImagePath, NumberOfTryGuessLetter = 0, Points = 0, UserInput = "", WrongLetters = "", Word = model.HostPlayer.Word }; game.SetUserNotInHostGameMode(userName); return(View(model)); } catch (Exception ex) { return(View("Index")); } }