public static Library InitializeLibrary() { var story1 = new Story("Story1", StoryType.Novella, true, "Name1"); var story2 = new Story("Story2", StoryType.ShortStory, false, "Name2"); var story3 = new Story("Story3", StoryType.Novellette, true, "Name3"); var story4 = new Story("Story4", StoryType.ShortStory, true, "Name4"); var story5 = new Story("Story5", StoryType.Novella, false, "Name5"); var novel1 = new Novel("Author1", "Novel1", TypeOfEdition.EBook, 400); var novel2 = new Novel("Author2", "Novel2", TypeOfEdition.Paperback, 270) { Series = "Novel", SeriesNumber = 2 }; var storyCollection1 = new StoryCollections("Name11", "Zbirka1", TypeOfEdition.Hardcover, 832); var storyCollection2 = new StoryCollections("Name22", "Zbirka2", TypeOfEdition.EBook, 327); storyCollection1.Stories.Add(story1); storyCollection1.Stories.Add(story4); storyCollection2.Stories.Add(story5); var anthology1 = new Anthology("Editor01", "Anthology1", TypeOfEdition.Audiobook, 432); var anthology2 = new Anthology("Editor02", "Anthology2", TypeOfEdition.EBook, 385); anthology1.Stories.Add(story3); anthology1.Stories.Add(story1); anthology2.Stories.Add(story2); anthology2.Stories.Add(story1); Library library = new Library(); library.Books = new List <IBook> { novel1, novel2, storyCollection1, storyCollection2, anthology1, anthology2 }; return(library); }
static void Main(string[] args) { Library thousandBooks = new Library("Thousand Books"); Novels ulysses = new Novels("James Joyce", "Ulysses", EditionType.Hardcover, 345, false); Novels theGreatGatsby = new Novels("F. Scott Fitzgerald", "The Great Gatsby", EditionType.EBook, 2222, false); Novels lolita = new Novels("Vladimir Nabokov", "Lolita", EditionType.AudioBook, 422, false); Novels catch22 = new Novels("Joseph Heller", "Catch 22", EditionType.Paperback, 356, false); Novels harryPoter = new Novels(" J. K. Rowling", "Harry Potter", EditionType.Hardcover, 4522, false); Novels harryPotterandtheHalfBloodPrince = new Novels("J.K. Rowling", "Harry Potter and the Half-Blood Prince", EditionType.Hardcover, 642, true); Novels harryPotterandTheGobletOfFire = new Novels("J.K. Rowling", "Harry Potter and the Goblet of Fire", EditionType.Hardcover, 922, true); Novels harryPoterAndTheChamberOfSeacret = new Novels("J.K. Rowling", "Harry Potter And The Chamber Of Seacret", EditionType.Hardcover, 399, true); harryPoter.AddToSeries(harryPoterAndTheChamberOfSeacret); harryPoter.AddToSeries(harryPotterandTheGobletOfFire); harryPoter.AddToSeries(harryPotterandtheHalfBloodPrince); StoryCollection sticks = new StoryCollection("Unknown", "Sticks", StoryType.ShortStory, true); StoryCollection victoryLap = new StoryCollection("Unknown", "Victory Lap", StoryType.Novellete, true); StoryCollections tenthOfDecember = new StoryCollections("George Saunders", "Tenth of December", EditionType.Paperback, 1244); tenthOfDecember.AddStory(sticks); tenthOfDecember.AddStory(victoryLap); Anthology fragileThings = new Anthology("Neil Gaiman", "fantastic", EditionType.Hardcover, 360, "Fragile Things"); StoryAnthology closingTime = new StoryAnthology("Closing Time", "Robert Aickman", StoryType.ShortStory, true); StoryAnthology aLoveStory = new StoryAnthology("A Love Story", "Waren Pleece", StoryType.ShortStory, true); fragileThings.AddStory(closingTime); fragileThings.AddStory(aLoveStory); thousandBooks.AddBook(harryPoter); thousandBooks.AddBook(tenthOfDecember); thousandBooks.AddBook(fragileThings); var allBooks = thousandBooks.GetBooks(); //------------------------------------------------------------------------------------ string input = Console.ReadLine(); if (input == "novela") { PrintNovela(allBooks); } Console.WriteLine("\n----------------"); if (input == "coll") { PrintCollectionStory(allBooks); } Console.WriteLine("\n----------------"); if (input == "ant") { PrintAnthology(allBooks); } Console.WriteLine("\n----------------"); //------------------------------------------------------------------------------------ // Print PrintCollectionStory(allBooks); Console.WriteLine("\n----------------"); Console.WriteLine("Anthology : \n"); PrintAnthology(allBooks); Console.WriteLine("\n----------------"); Console.WriteLine("Novelas : \n"); PrintNovela(allBooks); Console.WriteLine("\n----------------"); Console.ReadLine(); }