static void AddCharacterToComic(ComicBook comic, string charactername, TypeOfCharacter charactertype) { var character = characters.FirstOrDefault(c => c.CharacterName == charactername); if (character == null) { var newcharacter = new Character(charactername, charactertype); characters.Add(newcharacter); comic.AddCharacter(newcharacter); } else { comic.AddCharacter(character); } }
static void AddContributorToComic(ComicBook comic, string contributorname, TypeOfContributor contributortype) { var contributor = contributors.FirstOrDefault(c => c.ContributorName == contributorname); if (contributor == null) { var newcontributor = new Contributor(contributorname, contributortype); contributors.Add(newcontributor); comic.AddConstributor(newcontributor); } else { comic.AddConstributor(contributor); } }
/// <summary> /// Add a comic book /// </summary> /// <param name="publisher">The publisher of the comic</param> /// <param name="bookTitle">The title of the comic</param> /// <param name="issueNumber">The issue number</param> /// <param name="publishedDate">The date the comic was published</param> /// <param name="coverPrice">The cover price of the comic</param> /// <returns>A comic book class</returns> static void AddComic(string publisher, string bookTitle, int issueNumber, DateTime publishedDate, Decimal coverPrice) { var newcomic = new ComicBook(publisher, bookTitle, issueNumber, publishedDate, coverPrice); collection.Add(newcomic); }