1

I have this:

_gameService = new GameService();
            ViewBag.Data = _gameService.JoinGame(userID, gameID, whoJoin);
            return View("Game");

This code gets list of users that are ingame, and pass it to game view. Nothing fancy.

On the game view I need to get single values from ViewBag in diffrent places, like UserID, GameID, Moves etc.

Using Strongly Typed view is not an option, because I need list of users that are in game, and strongly-typed view give me only option to store single user(which won't work in multiplayer game)

Łukasz Baran
  • 1,229
  • 3
  • 24
  • 47

1 Answers1

1

You should really use strongly typed views. Here is small intro. They are really more flexible. You can create class like PlayerList with a field of List type and then iterate it in your view (Explanation). And here is explanation how to pass strongly typed lists to View.

Community
  • 1
  • 1
Andrey
  • 59,039
  • 12
  • 119
  • 163