Exemplo n.º 1
0
 /// <summary>
 /// Method for sorting books in the way depending on comparer
 /// </summary>
 /// <param name="comparer">IComparer object</param>
 public void SortBooksByTag(IComparer<Book> comparer)
 {
     try
     {
         if (comparer == null)
         {
             logger.Error("Error while sorting with comparer");
             throw new ArgumentNullException("Comparer is null");
         }
         books = repository.LoadToList();
         books.Sort(comparer);
         logger.Info("Sorted successfully");
         repository.LoadToFile(books);
     }
     catch (Exception e)
     {
         logger.Info(e.Message);
         logger.Error(e.StackTrace);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Method for sorting books in some way
 /// </summary>
 public void SortBooksByTag()
 {
     try
     {
         books = repository.LoadToList();
         books.Sort(Comparer<Book>.Default);
         logger.Info("Sorted successfully");
         repository.LoadToFile(books);
     }
     catch (Exception e)
     {
         logger.Info(e.Message);
         logger.Error(e.StackTrace);
     }
 }