public DTO.Player MaakLobby(DTO.Player player) { try { //Stop eventuele hosting van een bestaande lobby StopHost(player); //maak nieuwe lobby Lobbi lobby = new Lobbi(); lobby.HostPlayer = player.PlayerNaam; lobby.CanJoinLobby = true; lobby.AantalPlayers = 1; lobby.HostID = player.PlayerId; lobby.WhosTunrId = 0; db.Lobbis.InsertOnSubmit(lobby); db.SubmitChanges(); var isHost = (from i in db.Players where i.PlayerId == player.PlayerId select i).FirstOrDefault(); isHost.Lobby = player.PlayerNaam; isHost.IsHost = true; isHost.HostID = player.PlayerId; db.SubmitChanges(); if (player.Lobby != null) { updatelobby(player.HostID); } player.HostID = player.PlayerId; player.Lobby = player.PlayerNaam; player.IsHost = true; return player; } catch (Exception) { return player; } }
partial void UpdateLobbi(Lobbi instance);
partial void DeleteLobbi(Lobbi instance);
partial void InsertLobbi(Lobbi instance);