public void AddNewWishlistBook(IAddNewWishlistBookView inForm, IWishlistRepository wishlistRepository) { if (inForm.ShowViewModal() == true) { try { string title = inForm.Title; string author = inForm.Author; string publisher = inForm.Publisher; DateTime datePub = inForm.DatePublished; int numPages = inForm.NumberOfPages; string genre = inForm.Genre; decimal price = inForm.Price; BookWishlist newWishlist = BookFactory.CreateBookWishlist(title, author, publisher, datePub, numPages, genre, price); wishlistRepository.AddBookWishlist(newWishlist); } catch (Exception ex) { MessageBox.Show("EXCEPTION: " + ex.Message); throw; } } }
public void LoadDefaultModel() { if (_defaultModelLoaded == false) { _readRepository.AddBookRead(new BookRead("It", "Stephen King", "Hodder", DateTime.Now, 1486, "horror", DateTime.Now, 5)); _readRepository.AddBookRead(new BookRead("Gone Girl", "Gillian Flynn", "Fraktura", DateTime.Now, 452, "thriller", DateTime.Now, 4)); _readRepository.AddBookRead(new BookRead("It Ends WIth Us", "Colleen Hoover", "Atria", DateTime.Now, 341, "romance", DateTime.Now, 5)); _tbrRepository.AddBookTBR(new BookTBR("Misery", "Stephen King", "Hodder", DateTime.Now, 410, "horror", "Ira")); _tbrRepository.AddBookTBR(new BookTBR("Little Fires Everywhere", "Celeste Ng", "Mozaik", DateTime.Now, 347, "literary fiction", "Tea")); _ownedRepository.AddBookOwned(new BookOwned("The Boy in the Headlights", "Samuel Bjork", "Znanje", DateTime.Now, 423, "crime", decimal.Parse("27.99"), "Tisak Media", false)); _ownedRepository.AddBookOwned(new BookOwned("Bird Box", "Josh Malerman", "Hodder", DateTime.Now, 423, "horror", decimal.Parse("49.90"), "Book Depository", true)); _libraryRepository.AddBookLibrary(new BookLibrary("Alive", "Anna Starobinets", "Hangar7", DateTime.Now, 298, "science fiction", DateTime.Now, DateTime.Now, "Gradska knjižnica Virovitica")); _wishlistRepository.AddBookWishlist(new BookWishlist("Anxious People", "Fredrik Backman", "Fokus", DateTime.Now, 423, "literary fiction", decimal.Parse("89"))); _wishlistRepository.AddBookWishlist(new BookWishlist("Kill Creek", "Scott Thomas", "Atria", DateTime.Now, 501, "horror", decimal.Parse("120"))); _defaultModelLoaded = true; } }