public ActionResult Lobby(int categoryId) { if (SessionLogin.UserIsInSession()) { LobbyViewModel lobbyViewModel = new LobbyViewModel(); lobbyViewModel.PlayerName = SessionLogin.UserName; lobbyViewModel.lobbies = lobbyClient.GetAllLobbiesWithCategoryId(categoryId).OrderByDescending(x => x.id).ToList(); lobbyViewModel.categoryId = categoryId; lobbyViewModel.user = userClient.GetUserByUsername(SessionLogin.UserName); lobbyViewModel.IsUserInLobby = lobbyClient.IsUserInLobby(SessionLogin.UserName); lobbyViewModel.DoesUserAlreadyOwnALobby = lobbyClient.DoesUserAlreadyOwnALobby(SessionLogin.UserName); return(View(lobbyViewModel)); } return(RedirectToAction("Index")); }