示例#1
0
        public async Task <List <Track> > GetTracks([FromQuery] string token)
        {
            var currentUser = HttpContext.User;
            var email       = currentUser.FindFirstValue(ClaimTypes.Email);

            using (var client = new HttpClient())
            {
                email = WebUtility.UrlEncode(email);
                token = WebUtility.UrlEncode(token);
                var json = await client.GetStringAsync($"http://data/playlist/tracks?email={email}&token={token}");

                return(await FetchDataUtility.Fetch(JsonConvert.DeserializeObject <List <Track> >(json)));
            }
        }
示例#2
0
        public async Task <List <Track> > GetTracks()
        {
            var currentUser = HttpContext.User;
            var email       = currentUser.FindFirstValue(ClaimTypes.Email);

            using (var client = new HttpClient())
            {
                email = WebUtility.UrlEncode(email);
                var json = await client.GetStringAsync($"http://data/likes?email={email}");

                var tracks = await FetchDataUtility.Fetch(JsonConvert.DeserializeObject <List <Track> >(json));

                tracks.ForEach(t => t.IsLiked = true);
                return(tracks);
            }
        }