public ActionResult Create([Bind(Include = "Id,Name,Age,JerseyNumber,Position,WCappearances,WCgoalsScored,SelectedTeamId")] PlayerModel player) { if (ModelState.IsValid) { player.Team = _teamsManager.ReturnTeam(player.SelectedTeamId); _playersManager.CreatePlayer(player); return(RedirectToAction("Index")); } return(View(player)); }
/////////////////////////////////// private void InitializePlayerOnClient(NetworkMessage message) { NetworkPlayerData playerDataMessage = message.ReadMessage <NetworkPlayerData>(); Room room = roomsManager.FindRoomById(playerDataMessage.roomId); PlayerData player = playersManager.CreatePlayer(playerDataMessage.id, playerDataMessage.name, room); if (!playersManager.IsActivePlayerSet && isPlayerNameReady) { playersManager.activePlayer = player; playersManager.IsActivePlayerSet = true; } room.playersInRoom.Add(player); if (playersManager.activePlayer.id == playerDataMessage.id) { SendMessageToServer(MessageConstants.RECENT_JOINED_PLAYER, new NetworkPlayerData(player)); } }