public async Task <IActionResult> ListFavourites() { var currentFavourites = _favouriteRepository.GetCurrentUserFavourites(); Dictionary <PlayerInfo, FileModel> combinedPlayerAndImage = new Dictionary <PlayerInfo, FileModel>(); PlayerInfo currentFavouriteInfo = new PlayerInfo(); FileModel currentPlayerImage = new FileModel(); //get up-to-date data on each favourite from the API and add to list foreach (var f in currentFavourites) { currentFavouriteInfo = await _cricApiRepository.GetPlayerInfo(f.Pid); currentPlayerImage = _fileRepository.GetImageByFavouriteId(f.Id); combinedPlayerAndImage.Add(currentFavouriteInfo, currentPlayerImage); } return(View(new FavouritesViewModel { CombinedPlayersAndImages = combinedPlayerAndImage })); }
public async Task <IActionResult> ShowPlayerStats(int pid) { PlayerInfo selectedPlayerInfo = await _cricApiRepository.GetPlayerInfo(pid); return(View(selectedPlayerInfo)); }