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; }
public void BorrowBook(Patron patron, BorrowableItem book) { try { Borrowing b = Borrowing.Issue(patron, book); _RecordOfBorrowings.Add(book.Title, b); } catch (BookBorrowedException e) { Console.WriteLine(e.Message); } catch (InvalidBorrowException e) { Console.WriteLine(e.Message); } catch (IssueBookException e) { Console.WriteLine(e.Message); } }
private Borrowing(Patron patron, BorrowableItem item) { _Item = item; _Patron = patron; _DueDate = patron.GetDueDate(); }