10 |
11 | Welcome,
12 |
13 |
14 |
15 |
16 |
17 | Image |
18 | Name |
19 |
20 |
21 |
22 | @{
23 | foreach (var item in Model.Playlists.Items)
24 | {
25 |
26 |
27 | @if(item.Images.Any()) {
28 |
29 | }
30 | |
31 |
32 | @item.Name
33 | |
34 |
35 | }
36 | }
37 |
38 |
39 | @if(Model.Previous != null) {
40 |
Previous
41 | }
42 | @if(Model.Next != null) {
43 |
Next
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/SpotifyAPI.Web.Examples/Example.ASP/Pages/Profile.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Microsoft.AspNetCore.Authentication;
3 | using Microsoft.AspNetCore.Mvc;
4 | using Microsoft.AspNetCore.Mvc.RazorPages;
5 | using SpotifyAPI.Web;
6 |
7 | namespace Example.ASP.Pages
8 | {
9 | public class ProfileModel : PageModel
10 | {
11 | private readonly SpotifyClientBuilder _spotifyClientBuilder;
12 | public ProfileModel(SpotifyClientBuilder spotifyClientBuilder)
13 | {
14 | _spotifyClientBuilder = spotifyClientBuilder;
15 | }
16 |
17 | public PrivateUser Me { get; set; }
18 |
19 | public async Task OnGet()
20 | {
21 | var spotify = await _spotifyClientBuilder.BuildClient();
22 |
23 | Me = await spotify.UserProfile.Current();
24 | }
25 |
26 | public async Task