/*** CONSTRUCTOR ***/ public LibrarySystem(IStoreBooks bookStorage, IStorePatrons patronStorage, IStoreLoans loanStorage) { // Init storage using Dependency Injection _bookStorage = bookStorage; _patronStorage = patronStorage; _loanStorage = loanStorage; // Create 3 sample books _bookStorage.Create(new Book(123, "The Hobbit", "Tolkien")); _bookStorage.Create(new Book(999, "Handmaids Tale", "Atwood")); _bookStorage.Create(new Book(76348, "Slaughterhouse five", "Vonnegut")); // Create 2 sample patrons _patronStorage.Create(new Patron(11118888, "Pablo", "Listingart")); _patronStorage.Create(new Patron(22227777, "Jesselyn", "Popoff")); }
/*** CONSTRUCTOR ***/ public LibrarySystem(IStoreBooks bookStorage, IStorePatrons patronStorage, IStoreLoans loanStorage) { // Init storage using Dependency Injection _bookStorage = bookStorage; _patronStorage = patronStorage; _loanStorage = loanStorage; // Create 3 sample books var newBook1 = new Book() { Id = Guid.NewGuid(), Title = "The Hobbit", Author = "Tolkien", IsCheckedOut = false }; var newBook2 = new Book() { Id = Guid.NewGuid(), Title = "Handmaids Tale", Author = "Atwood", IsCheckedOut = false }; var newBook3 = new Book() { Id = Guid.NewGuid(), Title = "Slaughterhouse five", Author = "Vonnegut", IsCheckedOut = false }; _bookStorage.Create(newBook1); _bookStorage.Create(newBook2); _bookStorage.Create(newBook3); // Create 2 sample patrons var patron1 = new Patron(Guid.NewGuid(), "Pablo", "Listingart"); Console.WriteLine($"Patron ID: {patron1.Id}"); _patronStorage.Create(patron1); _patronStorage.Create(new Patron(Guid.NewGuid(), "Jesselyn", "Popoff")); }
/*** CONSTRUCTOR ***/ public LibrarySystem(IStoreBooks bookStorage, IStorePatrons patronStorage, IStoreLoans loanStorage) { // Init storage using Dependency Injection _bookStorage = bookStorage; _patronStorage = patronStorage; _loanStorage = loanStorage; // Create 3 sample books var newBook1 = new Book() { Id = 123, Title = "The Hobbit", Author = "Tolkien", IsCheckedOut = false }; var newBook2 = new Book() { Id = 999, Title = "Handmaids Tale", Author = "Atwood", IsCheckedOut = false }; var newBook3 = new Book() { Id = 76348, Title = "Slaughterhouse five", Author = "Vonnegut", IsCheckedOut = false }; _bookStorage.Create(newBook1); _bookStorage.Create(newBook2); _bookStorage.Create(newBook3); // Create 2 sample patrons _patronStorage.Create(new Patron(11118888, "Pablo", "Listingart")); _patronStorage.Create(new Patron(22227777, "Jesselyn", "Popoff")); }
public void AddPatron(Patron newPatron) { _patronStorage.Create(newPatron); }