-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFilters.cs
54 lines (47 loc) · 1.86 KB
/
Filters.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using api_request.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace api_request
{
public class Filters
{
public static void FilterByGenders(List<Music> musicslist)
{
var genderslist = musicslist.Select(genders => genders.Gender) .Distinct().ToList();
foreach (var allgenders in genderslist)
{
Console.WriteLine("genders are : "+allgenders);
}
}
public static void FilterByArtistNames(List<Music> musicslist)
{
var namesArtists = musicslist.OrderBy(names => names.Artist).Select(names => names.Artist).Distinct().ToList();
//filter by name and select by
foreach (var artist in namesArtists)
{
Console.WriteLine("artist name :" + artist);
}
}
public static void FilterArtistByGender(List<Music> musicslist, string gender)
{
var ArtistsByGender = musicslist.Where(musics=> musics.Gender.Contains(gender)).Select(musics=> musics.Artist).Distinct().ToList();
Console.WriteLine($"Exibindo artistas pelo gênero musical {gender}:");
foreach (var artist in ArtistsByGender)
{
Console.WriteLine($"Artistas:{artist}");
}
}
public static void FilterMusicsFromArtist(List<Music> musicslist, string artist_name)
{
var MusicsFromArtist = musicslist.Where(artists=> artists.Artist!.Equals(artist_name)).Select(artists=> artists.Song).Distinct().ToList();
Console.WriteLine($"Exibindo musicas do artistas/banda {artist_name} ");
foreach (var songs in MusicsFromArtist)
{
Console.WriteLine($"Musicas :{songs}");
}
}
}
}