public async Task <ActionResult> Details(int?id) { if (id == null) { return(Content("No game ID has been provided.")); } var igdbService = new IGDBService(); var game = await igdbService.GetGameDetailsAsync((int)id); return(View("GameDetails", new GameDetailsViewModel(game))); }
public async Task <ActionResult> AddGameToDb(int id) { var igdbService = new IGDBService(); var game = await igdbService.GetGameDetailsAsync(id); var gameApiLink = new GameApiLink { Name = game.Name, GameIdentifier = game.Id, GenreIds = game.GenreIds }; db.Games.Add(gameApiLink); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }