Exemple #1
0
        public async Task <IActionResult> SelectAlbumByArtist(string artistId)
        {
            if (string.IsNullOrWhiteSpace(artistId))
            {
                RedirectToAction("SelectAlbums");
            }

            var fullArtist = await _spotifyService.GetArtistById(artistId);

            CronosState.SelectedArtist = _mapper.Map <Artist>(fullArtist);

            var albums = await _spotifyService.GetAlbumsByArtistAsync(artistId);

            CronosState.AlbumResults = _mapper.Map <IEnumerable <Album> >(albums);
            CronosState.CurrentState = UserState.SelectAlbums;

            var vm = _mapper.Map <SelectAlbumsViewModel>(CronosState);

            return(View("SelectAlbums", vm));
        }