Exemplo n.º 1
0
        public GameSale(MyHome input)
        {
            myHome = input;
            InitializeComponent();
            Responses <GameDTOs> GameResponse = GameControllerShould.GetAllGamesController();
            List <GameDTOs>      gameDTOs     = GameResponse.Payload;

            foreach (GameDTOs a in gameDTOs)
            {
                GameObject temp1 = toGameObject(a);
                lib_game.Add(temp1);
            }
            foreach (GameObject game in lib_game)
            {
                GameCollection.Items.Add(game.Name);
            }
            GameCollection.Text = "Choose a game to sale";
        }
Exemplo n.º 2
0
        public void LoadDatabase(string UserId)
        {
            GameResponse     = GameControllerShould.GetAllGamesController();
            User             = AccountsControllerShould.GetUserByIdController(UserId);
            GameSaleResponse = GameControllerShould.GetAllGamesSaleController();


            List <GameDTOs> gameDTOs = GameResponse.Payload;

            foreach (GameDTOs a in gameDTOs)
            {
                GameObject temp1 = toGameObject(a);
                lib_game.Add(temp1);
            }

            foreach (TitleGame a in User.Games)
            {
                Response <GameDTOs> temp    = GameControllerShould.GetGameByIdController(a.Id.ToString());
                GameObject          gameobj = toGameObject(temp.Payload);
                user_game.Add(gameobj);
            }

            //foreach (TitleGame a in User.WishGames)
            //{
            //    Response<GameDTOs> temp = GameControllerShould.GetGameByIdController(a.Id.ToString());
            //    GameObject gameobj = toGameObject(temp.Payload);
            //    user_wishgame.Add(gameobj);
            //}

            foreach (GameDTOs a in GameSaleResponse.Payload)
            {
                GameObject gameobj = toGameObject(a);
                sale_game.Add(gameobj);
            }
            if (sale_game.Count() < 4)
            {
                for (int i = 0; i < 4; i++)
                {
                    sale_game.Add(lib_game.ElementAt(i));
                }
            }
        }