public ActionResult CreateRoom(CreateRoomData data) { var games = GetGamesFromCache(HttpContext.Cache); // Создаем новую игровую комнату var game = new GameInfo() { Player1 = User.Identity.Name, Field = new int[data.FieldWidth, data.FieldWidth] }; string GameId = Guid.NewGuid().ToString(); games[GameId] = game; // обновляем ссылку на объект в кэше HttpContext.Cache["Games"] = games; return RedirectToAction("Room", new { id = GameId }); }
public ActionResult CreateRoom() { var model = new CreateRoomData { FieldWidth = 32 }; return View(model); }