-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
36 lines (31 loc) · 1.18 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using api_request.Models;
using System.Text.Json;
namespace api_request
{
internal class Program
{
static async Task Main(string[] args)
{
try
{
HttpClient client = new HttpClient();
string response = await client.GetStringAsync("https://guilhermeonrails.github.io/api-csharp-songs/songs.json");
var deserializedMusic = JsonSerializer.Deserialize<List<Music>>(response)!;
// Filters.FilterByGenders(deserializedMusic);
// Filters.FilterByArtistNames(deserializedMusic);
// string c = "rock";
// Filters.FilterArtistByGender(deserializedMusic,c);
// string name = "Green Day";
// Filters.FilterMusicsFromArtist(deserializedMusic,name);
var prefmusics = new FavMusics("pedro");
prefmusics.AddFavMusics(deserializedMusic[2]);
prefmusics.ShowFavMusics();
prefmusics.GenerateJson();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}