Beispiel #1
0
        public ActionResult Index(AlbumSearch searchBox)
        {
            var albums = db.Albums
                         .Where(a => a.Title.Contains(searchBox.Search));

            return(View(albums.ToList()));
        }
        public static void Main()
        {
            while (true)
            {
                Console.WriteLine("Search for album and artists:");

                string searchString = Console.ReadLine();

                IEnumerable <WebArtist> artists = ArtistSearch.SearchFor(searchString);

                Console.WriteLine("---ARTISTS---");
                foreach (var artist in artists)
                {
                    Console.WriteLine("Artist: {0}, Guid: {1}", artist.Name, artist.Id);
                }

                IEnumerable <WebAlbum> albums = AlbumSearch.SearchForAlbum(searchString);

                Console.WriteLine("---ALBUMS---");
                foreach (var album in albums)
                {
                    Console.WriteLine("Artist: {0}, Album: {1}", album.Artist, album.Title);
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            // Cache Load Testing
            //Cache.LoadTest();


            AlbumSearch.Start();
        }
 private void SearchForAlbums(string album)
 {
     AlbumSearch.SearchForAlbumAsync(album, albums =>
     {
         DispatcherHelper.CheckBeginInvokeOnUI(() => {
             this.SearchResultsViewModel.LoadAlbums(albums);
             //this.CanMoveNext = albums.Count() > 0;
             this.CanShowResults = true;
             this.IsSearching    = false;
         });
     });
 }
Beispiel #5
0
        public void LoadAlbumsForArtist(WebArtist artist)
        {
            _parent.IsSearching = true;
            AlbumSearch.SearchForAlbumFromArtistGuidAsync(artist.Id, results =>
            {
                _albums = results.ToList();

                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    _parent.IsSearching = false;
                    this.SearchResults.Clear();

                    foreach (var album in _albums)
                    {
                        this.SearchResults.Add(album);
                    }

                    this.AlbumCount = String.Format("ALBUMS ({0})", _albums.Count());

                    this.IsAlbumsEnabled = true;
                });
            });
        }
Beispiel #6
0
        public async Task <IActionResult> OnPostDataAsync(int page, int rows, AlbumSearch where)
        {
            var data = await _service.GetListAsync(page, rows, where, null);

            return(PagerData(data.items, page, rows, data.count));
        }
Beispiel #7
0
    /// <summary>
    /// Perform generic lookup based on artist name and album
    /// title.
    /// </summary>
    /// <param name="maxMaxResults">Number of MaxResults to return</param>
    /// <returns>Collection of album tags</returns>
    /// <remarks>
    /// Is actually calling albumSearch() which accepts both
    /// artist and album as input.
    /// </remarks>
    private List<Metadata> AlbumLookup()
    {
      Trace.WriteLine("Performing album  lookup. Artist: "
                      + Tokens["artist"]
                      + " Release: "
                      + Tokens["release"]);
      
      AlbumSearch search = new AlbumSearch(Tokens["artist"] + " - " + Tokens["release"], session);
      search.SpecifyItemsPerPage(MaxResults);
      List<Metadata> tmp = (from album in search.GetPage((int)Pages.FIRST)
                       select album.ToTag()).ToList<Metadata>();
      MaxResults = MaxResults - tmp.Count();

      Trace.WriteLine("MaxResults: " + tmp.Count());
      return tmp;
    }