Ejemplo n.º 1
0
        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 });
        }
Ejemplo n.º 2
0
 public ActionResult CreateRoom()
 {
     var model = new CreateRoomData { FieldWidth = 32 };
     return View(model);
 }