示例#1
0
        /// <summary>
        /// The handle to get requested album
        /// </summary>
        /// <param name="request">The request with filter params</param>
        /// <param name="cancellationToken">The cancellation token</param>
        /// <returns>The task with the requested album</returns>
        public async Task <GetAlbumQueryResult> Handle(GetAlbumQuery request, CancellationToken cancellationToken)
        {
            BusinessValidation(request);

            var album = await spotifyService.GetAlbumAsync(request.Id);

            return(await Task.FromResult(new GetAlbumQueryResult(album.Id, album.Name, album.ReleaseDate, album.TotalTracks, RandomPricesHelper.GetPrice())));
        }
示例#2
0
        private async void LoadData(string id)
        {
            IsLoading = true;

            try
            {
                Album = await _service.GetAlbumAsync(id);

                foreach (var simpleTrack in Album.Tracks.Items)
                {
                    simpleTrack.Artist = Album.Artists[0];
                }
                Tracks = new ObservableCollection <SimpleTrack>(Album.Tracks.Items);
            }
            catch
            {
                CurtainPrompt.ShowError("AppNetworkIssue".FromLanguageResource());
            }
            IsLoading = false;
        }