Exemple #1
0
        public void Save(IBookListStorage bookListStorage)
        {
            if (ReferenceEquals(bookListStorage, null))
            {
                throw new ArgumentNullException();
            }

            bookListStorage.SaveBooks(Books);
        }
Exemple #2
0
        /// <summary>
        /// Saves the in storage.
        /// </summary>
        /// <param name="storage">The storage.</param>
        /// <exception cref="ArgumentNullException">Throw when the storage is null</exception>
        public void SaveInStorage(IBookListStorage storage)
        {
            if (ReferenceEquals(storage, null))
            {
                throw new ArgumentNullException($"Argument {nameof(storage)} is null");
            }

            storage.SaveBooks(Books);

            logger.Debug($"List of books saved successfully!\n");
        }
 public void SaveIntoStorage(IBookListStorage storage)
 {
     try
     {
         storage.SaveBooks(BookList);
     }
     catch (Exception ex)
     {
         throw new BooksStorageException("Error was occured while saving books from the storage", ex);
     }
 }
 /// <summary>
 /// Save books to the specified storage.
 /// </summary>
 /// <param name="books">Books to be stored.</param>
 public void SaveBooks(IBookListStorage storage)
 {
     storage.SaveBooks(Books);
 }
Exemple #5
0
 public void Save()
 {
     bookListStorage.SaveBooks(books);
 }