public async Task DeleteDisc(ItemId discId, string deleteComment, CancellationToken cancellationToken)
        {
            var deleteTime = clock.Now;

            var disc = DiscLibrary.GetDisc(discId);

            logger.LogInformation($"Deleting the disc '{disc.TreeTitle}' ...");

            foreach (var song in disc.ActiveSongs)
            {
                await songsService.DeleteSong(song, deleteTime, deleteComment, cancellationToken);
            }

            if (disc.CoverImage != null)
            {
                logger.LogInformation($"Deleting disc cover image '{disc.CoverImage.TreeTitle}' ...");
                await DeleteDiscCoverImage(disc.CoverImage, cancellationToken);
            }

            var updateDisc = false;
            var deleteOrphanAdviseGroups = false;

            if (disc.AdviseGroup != null)
            {
                // We erase advise group so that it could be deleted when no references left.
                disc.AdviseGroup         = null;
                updateDisc               = true;
                deleteOrphanAdviseGroups = true;
            }

            if (disc.AdviseSetInfo != null)
            {
                // We erase advise set for several reasons:
                // 1. In order to unnecessary (empty) advise sets could be deleted (manually).
                // 2. In order to deleted discs do not interfere with active discs within same advise set.
                //    Otherwise some care should be taken in adviser for handling this case.
                // Overall there is no any use of advise sets for deleted discs.
                disc.AdviseSetInfo = null;
                updateDisc         = true;
            }

            if (updateDisc)
            {
                await discsRepository.UpdateDisc(disc, cancellationToken);
            }

            if (deleteOrphanAdviseGroups)
            {
                await adviseGroupService.DeleteOrphanAdviseGroups(cancellationToken);
            }

            logger.LogInformation($"The Disc '{disc.TreeTitle}' was deleted successfully");
        }
        public void LoadForSongs(IReadOnlyCollection <SongModel> songs)
        {
            ConfirmationMessage = $"Do you really want to delete {songs.Count} selected song(s)?";
            DeleteComment       = null;

            DeleteAction = async cancellationToken =>
            {
                foreach (var song in songs)
                {
                    await songService.DeleteSong(song, DeleteComment, cancellationToken);
                }
            };
        }
 public IActionResult Delete(Song sng)
 {
     _songsService.DeleteSong(sng.SongId);
     return(RedirectToAction("Index", "Home"));
 }