Beispiel #1
0
        public void SetDeleted()
        {
            IsDeleted = true;
            UpdatedOn = DateTime.UtcNow;
            BookDeletedEvent bookDeletedEvent = new BookDeletedEvent(this);

            AddDomainEvent(bookDeletedEvent);
        }
Beispiel #2
0
        public void HandleAsync(BookDeletedEvent message)
        {
            var path = GetBookCoverPath(message.Book.Id);

            if (_diskProvider.FolderExists(path))
            {
                _diskProvider.DeleteFolder(path, true);
            }
        }
Beispiel #3
0
 public void HandleAsync(BookDeletedEvent message)
 {
     if (message.DeleteFiles)
     {
         var files = _mediaFileService.GetFilesByBook(message.Book.Id);
         foreach (var file in files)
         {
             DeleteFile(file);
         }
     }
 }
Beispiel #4
0
 public void HandleAsync(BookDeletedEvent message)
 {
     if (message.DeleteFiles)
     {
         _mediaFileRepository.DeleteFilesByBook(message.Book.Id);
     }
     else
     {
         _mediaFileRepository.UnlinkFilesByBook(message.Book.Id);
     }
 }
 public void HandleAsync(BookDeletedEvent message)
 {
     if (message.DeleteFiles)
     {
         var files = _mediaFileService.GetFilesByBook(message.Book.Id);
         foreach (var file in files)
         {
             _recycleBinProvider.DeleteFile(file.Path);
         }
     }
 }
Beispiel #6
0
        public void Handle(BookDeletedEvent message)
        {
            var deleteMessage = new BookDeleteMessage(message.Book, message.DeleteFiles);

            foreach (var notification in _notificationFactory.OnBookDeleteEnabled())
            {
                try
                {
                    if (ShouldHandleAuthor(notification.Definition, deleteMessage.Book.Author))
                    {
                        notification.OnBookDelete(deleteMessage);
                    }
                }
                catch (Exception ex)
                {
                    _logger.Warn(ex, "Unable to send OnBookDelete notification to: " + notification.Definition.Name);
                }
            }
        }
        public void HandleAsync(BookDeletedEvent message)
        {
            if (!message.AddImportListExclusion)
            {
                return;
            }

            var existingExclusion = _repo.FindByForeignId(message.Book.ForeignBookId);

            if (existingExclusion != null)
            {
                return;
            }

            var importExclusion = new ImportListExclusion
            {
                ForeignId = message.Book.ForeignBookId,
                Name      = $"{message.Book.AuthorMetadata.Value.Name} - {message.Book.Title}"
            };

            _repo.Insert(importExclusion);
        }
Beispiel #8
0
 public void Handle(BookDeletedEvent message)
 {
     BroadcastResourceChange(ModelAction.Deleted, message.Book.ToResource());
 }
Beispiel #9
0
 public void Handle(BookDeletedEvent message)
 {
     UpdateBookCache(message.Book.Id);
 }
Beispiel #10
0
 public void Handle(BookDeletedEvent message)
 {
     _cache.Remove("AllAuthors");
     _cache.Remove(message.Book.AuthorId.ToString());
 }