예제 #1
0
        private async void SavePlaylist()
        {
            string coverPlaylist = "";

            if (absolutePathCover != null)
            {
                coverPlaylist = Utils.Encoder.EncodeBase64(absolutePathCover);
            }
            Playlist playlist = new Playlist()
            {
                cover          = coverPlaylist,
                idAccount      = idAccount,
                idPlaylistType = 4,
                title          = TextBox_title_playlist.Text,
                publicPlaylist = IsPublicPlaylist()
            };

            try
            {
                var response = await PlaylistRepository.CreatePlaylistAsync(playlist);

                if (response)
                {
                    MessageBox.Show("Playlist has been created");
                    Window.GetWindow(this).Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }