예제 #1
0
        public async Task <dynamic> GetTracksSuggestions(string city)
        {
            var forecast = await openWeatherService.GetCurrentTemperatureAsync(city);

            await spotifyService.Authentication();

            string genre = "";

            switch (forecast.Temperature)
            {
            case > 30:
                genre = "party";
                break;

            case > 15:
                genre = "pop";
                break;

            case > 10:
                genre = "rock";
                break;

            case < 10:
                genre = "classical";
                break;
            }
            ;

            var tracks = await spotifyService.GetTracksByGenreAsync(genre);

            return(new {
                temp = forecast.Temperature,
                city,
                country = forecast.Country,
                tracks = tracks.items
            });
        }