Esempio n. 1
0
        public void TesteGerarListaDeveloper()
        {
            IgdbService       igdb     = new IgdbService();
            DadosGameResponse response = igdb.DadosJogo(428).FirstOrDefault();

            List <DadosDeveloperPublisherResponse> devs = igdb.DadosDeveloperPublisher(response.Developers.ToArray());
            List <DadosDeveloperPublisherResponse> pubs = igdb.DadosDeveloperPublisher(response.Publishers.ToArray());

            GameDataView gameDataView = GameDataView.init();

            foreach (DadosDeveloperPublisherResponse dev in devs)
            {
                gameDataView.ListaDeveloper.Add(new developerPublisher {
                    name = dev.Name
                });
            }

            foreach (DadosDeveloperPublisherResponse pub in pubs)
            {
                gameDataView.ListaPublisher.Add(new developerPublisher {
                    name = pub.Name
                });
            }

            Assert.IsNotNull(gameDataView.ListaDeveloper);
            Assert.IsNotNull(gameDataView.ListaPublisher);
        }
Esempio n. 2
0
        public void TesteSalvarJogoView()
        {
            IgdbService        igdb     = new IgdbService();
            DadosGameResponse  response = igdb.DadosJogo(428).FirstOrDefault();
            PlatformRepository pr       = new PlatformRepository();
            List <DadosDeveloperPublisherResponse> devs = igdb.DadosDeveloperPublisher(response.Developers.ToArray());
            List <DadosDeveloperPublisherResponse> pubs = igdb.DadosDeveloperPublisher(response.Publishers.ToArray());

            GameDataView gameDataView = GameDataView.init();

            gameDataView.Titulo      = response.Name;
            gameDataView.Descricao   = response.Summary;
            gameDataView.CloudnaryId = response.Cover.CloudinaryId;

            foreach (DadosDeveloperPublisherResponse dev in devs)
            {
                gameDataView.ListaDeveloper.Add(new developerPublisher {
                    name = dev.Name
                });
            }

            foreach (DadosDeveloperPublisherResponse pub in pubs)
            {
                gameDataView.ListaPublisher.Add(new developerPublisher {
                    name = pub.Name
                });
            }

            foreach (ReleaseDate lancamento in response.ReleaseDates)
            {
                platform plataforma = pr.GetPlatformByIgdb(lancamento.Platform);
                if (plataforma != null)
                {
                    DateTime data = new DateTime(1970, 1, 1, 0, 0, 0).AddMilliseconds(Convert.ToDouble(Convert.ToDouble(lancamento.Date)));
                    gameDataView.Platforms.Add(new game_platform {
                        id_platform  = plataforma.id,
                        release_date = data,
                        id_region    = lancamento.Region
                    });
                }
            }

            GameRepository gameRepository = new GameRepository();

            gameRepository.Adicionar(gameDataView);
        }
Esempio n. 3
0
        public ActionResult PreencherDadosGameEntityJquery(int id)
        {
            GameRepository gameRepository = new GameRepository();
            DeveloperPublisherRepository devPubRepository = new DeveloperPublisherRepository();
            GameEntity game = gameRepository.BuscarDados(id);

            List <game_developerPublisher> devs = game.game_developerPublisher.Where(d => d.tipo == (int)GameDataView.tipoDeveloperPublisher.Developer).ToList();
            List <game_developerPublisher> pubs = game.game_developerPublisher.Where(p => p.tipo == (int)GameDataView.tipoDeveloperPublisher.Publisher).ToList();
            List <game_genre> genres            = game.game_genre.ToList();

            GameDataView gameDataView = GameDataView.init();

            gameDataView.Id        = game.id;
            gameDataView.id_igdb   = game.id_igdb;
            gameDataView.Titulo    = game.name;
            gameDataView.Descricao = game.summary;
            gameDataView.Nota      = game.nota;
            gameDataView.Completo  = game.completo;

            string arquivo = gameDataView.Imagesfolder + game.id + "_BigCover_" + game.cloudnary_id + ".jpg";

            if (System.IO.File.Exists(arquivo))
            {
                gameDataView.Imagem      = "~/images/" + game.id + "_BigCover_" + game.cloudnary_id + ".jpg";
                gameDataView.CloudnaryId = game.cloudnary_id;
            }

            foreach (game_developerPublisher dev in devs)
            {
                gameDataView.ListaDeveloper.Add(new developerPublisher {
                    id      = dev.id,
                    id_igdb = devPubRepository.GetIgdbById(dev.id_developerPublisher),
                    name    = dev.developerPublisher.name
                });
            }

            foreach (game_developerPublisher pub in pubs)
            {
                gameDataView.ListaPublisher.Add(new developerPublisher {
                    id      = pub.id,
                    id_igdb = devPubRepository.GetIgdbById(pub.id_developerPublisher),
                    name    = pub.developerPublisher.name
                });
            }

            foreach (game_genre genre in genres)
            {
                gameDataView.ListaGenre.Add(new genre {
                    id   = genre.id,
                    name = genre.genre.name
                });
            }

            foreach (game_platform lancamento in game.game_platform)
            {
                gameDataView.Platforms.Add(new game_platform {
                    id           = lancamento.id,
                    release_date = lancamento.release_date,
                    metacritic   = lancamento.metacritic,
                    preco        = lancamento.preco,
                    formato      = lancamento.formato,
                    tamanho      = lancamento.tamanho,
                    id_platform  = lancamento.id_platform,
                    id_status    = lancamento.id_status,
                    id_region    = lancamento.id_region,
                    id_rating    = lancamento.id_rating,
                    id_store     = lancamento.id_store,
                    store        = lancamento.store
                });
            }

            return(PartialView("FormGameView", gameDataView));
        }
Esempio n. 4
0
 public ActionResult ExibirFormGame()
 {
     return(PartialView("FormGameView", GameDataView.init()));
 }