public ActionResult <CategoryList> GetCategories(string country) { try { var result = _spotifyService.GetCategories(country, "", 50, 0); if (result == null) { return(NotFound()); } return(Ok(result)); } catch (System.Exception e) { return(BadRequest(e.Message)); throw; } }
// GET: Collect public ActionResult Index() { // Get new releases var albums = _spotifyService.GetNewReleases(); // Get categories var categories = _spotifyService.GetCategories(); var categorySelectItems = new List <SelectListItem>(); foreach (var category in categories.items) { categorySelectItems.Add(new SelectListItem { Value = category.id, Text = category.name }); } // Get genres var genres = _spotifyService.GetGenres(); var genreSelectListItems = new List <SelectListItem>(); foreach (var genre in genres) { genreSelectListItems.Add(new SelectListItem { Value = genre, Text = genre }); } return(View(new CollectViewModel { NewReleases = albums, Categories = categorySelectItems, Genres = genreSelectListItems })); }