コード例 #1
0
        public static Borrowing Issue(Patron patron, BorrowableItem item)
        {
            Borrowing ret = null;

            if (item.BorrowedBy != null)
                throw new BookBorrowedException();

            ret = new Borrowing(patron, item);
            item.BorrowedBy = ret;
            patron.BorrowedBooks.Add(ret);

            return ret;
        }
コード例 #2
0
 public void ReturnBook(Borrowing borrowing)
 {
     try
     {
         borrowing.ReturnBook();
         _RecordOfBorrowings.Remove(borrowing.Item.Title);
     }
     catch (ReturnBookException e)
     {
         Console.WriteLine(e.Message);
     }
 }