public List <string> Get() { List <Game> games = _gameDAL.GetAll(); List <string> result = new List <string>(); JavaScriptSerializer js = new JavaScriptSerializer(); GameDBModel gameDB = new GameDBModel(); foreach (var Game in games) { gameDB = gameDB.CreateFromGameModel(Game); result.Add(js.Serialize(gameDB)); } return(result); }
public ActionResult Room() { RoomViewModel roomViewModel = new RoomViewModel(); roomViewModel.UsPlayer = PlayerDAL.GetByName(Session["username"].ToString()); roomViewModel.ListOfRooms = RoomDAL.GetAll(); if (roomViewModel.UsPlayer.Room != null) { roomViewModel.Room = RoomDAL.Get(Convert.ToInt32(roomViewModel.UsPlayer.Room)); roomViewModel.PlayersInRoom = PlayerDAL.GetAll().Where(x => x.Room == roomViewModel.Room.Id).ToList(); roomViewModel.GamesInRoom = GameDAL.GetAll().Where(x => x.Room == roomViewModel.Room.Id).ToList(); } return(View(roomViewModel)); }
public List <Game> GetAll() { return(GameDAL.GetAll()); }