Beispiel #1
0
        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));
        }
Beispiel #2
0
        public GameDBModel CreateFromGameModel(Game game)
        {
            RoomDAL _roomDAL = new RoomDAL();

            GameDBModel tempModel = new GameDBModel();

            tempModel.Id          = game.Id;
            tempModel.Name        = game.Name;
            tempModel.Time        = game.Time;
            tempModel.Password    = game.Password;
            tempModel.RoomName    = _roomDAL.Get(Convert.ToInt32(game.Room)).Name;
            tempModel.Description = game.Description;


            return(tempModel);
        }