Beispiel #1
0
            public void Delete()
            {
                _playlistManager.CreatePlaylist(playlist1);
                _playlistManager.CreatePlaylist(playlist2);
                _playlistManager.DeletePlaylist(playlist2.Name);

                Assert.AreEqual(1, _playlistManager.GetAllPlaylists().Count);
            }
 private void DeleteSelectedPlaylist(object sender, RoutedEventArgs e)
 {
     if (MenuShowPlaylists.IsChecked && List.SelectedItem != null)
     {
         _playlistManager.DeletePlaylist(List.SelectedItem.ToString());
         ShowPlaylists(sender, e);
     }
     else
     {
         new AlertMessage("You must select playlist first.", "").ShowDialog();
     }
 }
Beispiel #3
0
        public async Task <IActionResult> DeletePlaylist(int id)
        {
            if (!ModelState.IsValid)
            {
                return(StatusCode(400));
            }

            if (await _manager.DeletePlaylist(id))
            {
                return(StatusCode(207));
            }

            throw new Exception();
        }
        public ActionResult Delete(long id)
        {
            var playlist = playlistManager.ReadPlaylist(id);
            var user     = userManager.ReadUser(User.Identity.Name);

            if (playlist.CreatedById == user.Id)
            {
                var deletedPlaylist = playlistManager.DeletePlaylist(id);
                if (deletedPlaylist == null)
                {
                    return(new HttpStatusCodeResult(400));
                }

                return(new HttpStatusCodeResult(200));
            }
            return(new HttpStatusCodeResult(403));
        }
 public void Cleanup()
 {
     playlistManager.DeletePlaylist(playlist.Id);
     userManager.DeleteUser(user.Id);
 }