Exemple #1
0
        public void CreatePlaylist()
        {
            int page         = 1;
            int playlistId   = PlaylistRepo.CreatePlaylist();
            var playlist     = PlaylistRepo.GetPlaylistByHackerNews().ToList();
            var playlistList = new List <PlaylistTrack>();

            for (var i = 1; i <= playlist.Count(); i++)
            {
                if (i % 10 == 0 || i == playlist.Count())
                {
                    var playlistString = JsonConvert.SerializeObject(playlistList);
                    PlaylistRepo.CreatePlaylistPage(playlistId, page, playlistString);
                    playlistList.Clear();
                    page++;
                }
                else
                {
                    playlistList.Add(playlist[i - 1]);
                }
            }
        }