Exemplo n.º 1
0
        private static void ChooseAddArtist(ComicBook comicBook)
        {
            _comicBookArtistRepository = new ComicBookArtistRepository(context);
            var comicArtists = _comicBookArtistRepository.GetList();

            ConsoleHelper.ClearOutput();
            ConsoleHelper.OutputBlankLine();
            Console.WriteLine("Artists");
            ConsoleHelper.OutputBlankLine();

            // List Artists out of ComicBookArtists
            foreach (var comicArtist in comicArtists)
            {
                ConsoleHelper.OutputLine("{0}) {1} - {2}",
                                         comicArtists.IndexOf(comicArtist) + 1,
                                         comicArtist.Artist.Name, comicArtist.Role.Name);
            }

            ConsoleHelper.OutputBlankLine();
            ConsoleHelper.Output("Choose an Artist [1-{0}] to Add, C - Cancel", comicArtists.Count);
            int result = 0;


            // choose Artist
            while (true)
            {
                var attemptChoice = ConsoleHelper.ReadInput("> ").ToLower();

                if (Int32.TryParse(attemptChoice, out result))
                {
                    // Add Artist
                    if (result < comicArtists.Count)
                    {
                        var artist = comicArtists[result - 1];
                        comicBook.AddArtist(artist.Artist, artist.Role);
                    }

                    break;
                }
                else if (attemptChoice == "c")
                {
                    // Cancel
                    break;
                }
            }

            context.Dispose();
        }
Exemplo n.º 2
0
        protected override void Seed(Context context)
        {
            var seriesSpiderMan = new Series()
            {
                Title       = "The Amazing Spider-Man",
                Description = "The Amazing Spider-Man (abbreviated as ASM) is an American comic book series published by Marvel Comics, featuring the adventures of the fictional superhero Spider-Man. Being the mainstream continuity of the franchise, it began publication in 1963 as a monthly periodical and was published continuously, with a brief interruption in 1995, until its relaunch with a new numbering order in 1999. In 2003 the series reverted to the numbering order of the first volume. The title has occasionally been published biweekly, and was published three times a month from 2008 to 2010. A film named after the comic was released July 3, 2012."
            };
            var seriesIronMan = new Series()
            {
                Title       = "The Invincible Iron Man",
                Description = "Iron Man (Tony Stark) is a fictional superhero appearing in American comic books published by Marvel Comics, as well as its associated media. The character was created by writer and editor Stan Lee, developed by scripter Larry Lieber, and designed by artists Don Heck and Jack Kirby. He made his first appearance in Tales of Suspense #39 (cover dated March 1963)."
            };
            var seriesBone = new Series()
            {
                Title       = "Bone",
                Description = "Bone is an independently published comic book series, written and illustrated by Jeff Smith, originally serialized in 55 irregularly released issues from 1991 to 2004."
            };

            var artistStanLee = new Artist()
            {
                Name = "Stan Lee"
            };
            var artistSteveDitko = new Artist()
            {
                Name = "Steve Ditko"
            };
            var artistArchieGoodwin = new Artist()
            {
                Name = "Archie Goodwin"
            };
            var artistGeneColan = new Artist()
            {
                Name = "Gene Colan"
            };
            var artistJohnnyCraig = new Artist()
            {
                Name = "Johnny Craig"
            };
            var artistJeffSmith = new Artist()
            {
                Name = "Jeff Smith"
            };

            var roleScript = new Role()
            {
                Name = "Script"
            };
            var rolePencils = new Role()
            {
                Name = "Pencils"
            };

            var comicBook1 = new ComicBook()
            {
                Series        = seriesSpiderMan,
                IssueNumber   = 1,
                Description   = "As Peter Parker and Aunt May struggle to pay the bills after Uncle Bens death, Spider-Man must try to save a doomed John Jameson from his out of control spacecraft. / Spideys still trying to make ends meet so he decides to try and join the Fantastic Four. When that becomes public knowledge the Chameleon decides to frame Spider-Man and steals missile defense plans disguised as Spidey.",
                PublishedOn   = new DateTime(1963, 3, 1),
                AverageRating = 7.1m
            };

            comicBook1.AddArtist(artistStanLee, roleScript);
            comicBook1.AddArtist(artistSteveDitko, rolePencils);
            context.ComicBooks.Add(comicBook1);

            var comicBook2 = new ComicBook()
            {
                Series        = seriesSpiderMan,
                IssueNumber   = 2,
                Description   = "The Vulture becomes the city's most feared thief. Spider-Man must find a way to figure out his secrets and defeat this winged menace. / Spider-Man is up against The Tinkerer and a race of aliens who are trying to invade Earth.",
                PublishedOn   = new DateTime(1963, 5, 1),
                AverageRating = 6.8m
            };

            comicBook2.AddArtist(artistStanLee, roleScript);
            comicBook2.AddArtist(artistSteveDitko, rolePencils);
            context.ComicBooks.Add(comicBook2);

            var comicBook3 = new ComicBook()
            {
                Series        = seriesSpiderMan,
                IssueNumber   = 3,
                Description   = "Spider-Man battles Doctor Octopus and is defeated, he considers himself a failure until the Human Torch gives a speech to his class which inspires him to go in prepared and win the day, leaving Doctor Octopus under arrest. Spider-Man visits the Torch with words of thanks.",
                PublishedOn   = new DateTime(1963, 7, 1),
                AverageRating = 6.9m
            };

            comicBook3.AddArtist(artistStanLee, roleScript);
            comicBook3.AddArtist(artistSteveDitko, rolePencils);
            context.ComicBooks.Add(comicBook3);

            var comicBook4 = new ComicBook()
            {
                Series        = seriesIronMan,
                IssueNumber   = 1,
                Description   = "A.I.M. manages to make three duplicates of the Iron Man armor.",
                PublishedOn   = new DateTime(1968, 5, 1),
                AverageRating = 7.6m
            };

            comicBook4.AddArtist(artistArchieGoodwin, roleScript);
            comicBook4.AddArtist(artistGeneColan, rolePencils);
            context.ComicBooks.Add(comicBook4);

            var comicBook5 = new ComicBook()
            {
                Series        = seriesIronMan,
                IssueNumber   = 2,
                Description   = "Stark competitor Drexel Cord builds a robot to destroy Iron Man.",
                PublishedOn   = new DateTime(1968, 6, 1),
                AverageRating = 6.7m
            };

            comicBook5.AddArtist(artistArchieGoodwin, roleScript);
            comicBook5.AddArtist(artistJohnnyCraig, rolePencils);
            context.ComicBooks.Add(comicBook5);

            var comicBook6 = new ComicBook()
            {
                Series        = seriesIronMan,
                IssueNumber   = 3,
                Description   = "While helping Stark, Happy once again turns into the Freak.",
                PublishedOn   = new DateTime(1968, 7, 1),
                AverageRating = 6.8m
            };

            comicBook6.AddArtist(artistArchieGoodwin, roleScript);
            comicBook6.AddArtist(artistJohnnyCraig, rolePencils);
            context.ComicBooks.Add(comicBook6);

            var comicBook7 = new ComicBook()
            {
                Series        = seriesBone,
                IssueNumber   = 1,
                Description   = "Fone Bone, Smiley Bone and Phoney Bone are run out of Boneville and get separated in the desert. Fone Bone finds his way to the valley.",
                PublishedOn   = new DateTime(1991, 7, 1),
                AverageRating = 7.1m
            };

            comicBook7.AddArtist(artistJeffSmith, roleScript);
            comicBook7.AddArtist(artistJeffSmith, rolePencils);
            context.ComicBooks.Add(comicBook7);

            var comicBook8 = new ComicBook()
            {
                Series        = seriesBone,
                IssueNumber   = 2,
                Description   = "While babysitting Miz Possum's children, Bone is chased by Rat Creatures, is saved by the Dragon and finally finds Thorn.",
                PublishedOn   = new DateTime(1991, 9, 1),
                AverageRating = 6.9m
            };

            comicBook8.AddArtist(artistJeffSmith, roleScript);
            comicBook8.AddArtist(artistJeffSmith, rolePencils);
            context.ComicBooks.Add(comicBook8);

            var comicBook9 = new ComicBook()
            {
                Series        = seriesBone,
                IssueNumber   = 3,
                Description   = "Grandma Ben returns from Barrelhaven and Phoney Bone and Bone reunite.",
                PublishedOn   = new DateTime(1991, 12, 1),
                AverageRating = 6.9m
            };

            comicBook9.AddArtist(artistJeffSmith, roleScript);
            comicBook9.AddArtist(artistJeffSmith, rolePencils);
            context.ComicBooks.Add(comicBook9);

            context.SaveChanges();
        }
        protected override void Seed(Context context)
        {
            //var type
            Series series1 = new Series()
            {
                Title = "The amazing spideman"
            };

            Series series2 = new Series()
            {
                Title = "The amazing spideman"
            };

            var artist1 = new Artist()
            {
                Name = "Stev Lee"
            };
            var artist2 = new Artist()
            {
                Name = "Leon Koweski"
            };
            var artist3 = new Artist()
            {
                Name = "Jack Koweski"
            };

            var role1 = new Role()
            {
                Name = "script"
            };
            var role2 = new Role()
            {
                Name = "Pencils"
            };

            var comicBook1 = new ComicBook()
            {
                Series      = series1,
                IssueNumber = 1,
                PublishedOn = DateTime.Today
            };

            comicBook1.AddArtist(artist1, role1);
            comicBook1.AddArtist(artist2, role2);


            var comicBook2 = new ComicBook()
            {
                Series      = series2,
                IssueNumber = 2,
                PublishedOn = DateTime.Today
            };

            comicBook2.AddArtist(artist1, role1);
            comicBook2.AddArtist(artist2, role2);
            var comicBook3 = new ComicBook()
            {
                Series      = series2,
                IssueNumber = 1,
                PublishedOn = DateTime.Today
            };

            comicBook3.AddArtist(artist1, role1);
            comicBook3.AddArtist(artist3, role2);

            context.ComicBooks.Add(comicBook1);
            context.ComicBooks.Add(comicBook2);
            context.ComicBooks.Add(comicBook3);

            context.SaveChanges();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            using (var context = new Context())
            {
                context.Database.Log = (message) => Debug.WriteLine(message);

                Series SpiderManSeries = new Series()
                {
                    Title = "The Spider Man Series"
                };

                Series BatManSeries = new Series()
                {
                    Title = "The Bat Man Series"
                };

                Artist artist1 = new Artist()
                {
                    Name = "Stan Lee"
                };
                Artist artist2 = new Artist()
                {
                    Name = "Bruce Lee"
                };
                Artist artist3 = new Artist()
                {
                    Name = "Chuck Norris"
                };

                Role role1 = new Role()
                {
                    Name = "Pencils"
                };
                Role role2 = new Role()
                {
                    Name = "Colors"
                };

                ComicBook comicbook1 = new ComicBook()
                {
                    Series      = SpiderManSeries,
                    IssueNumber = 1,
                    Description = "Really Neato",
                    PublishedOn = DateTime.Today,
                    Price       = 5.25M
                };
                ComicBook comicbook2 = new ComicBook()
                {
                    Series      = SpiderManSeries,
                    IssueNumber = 2,
                    Description = "Really Cool",
                    PublishedOn = DateTime.Today,
                    Price       = 3.45M
                };
                ComicBook comicbook3 = new ComicBook()
                {
                    Series      = BatManSeries,
                    IssueNumber = 1,
                    Description = "Really Neato",
                    PublishedOn = DateTime.Today,
                    Price       = 4M
                };

                comicbook1.AddArtist(artist1, role1);
                comicbook1.AddArtist(artist2, role2);
                comicbook2.AddArtist(artist3, role1);
                comicbook2.AddArtist(artist2, role2);
                comicbook3.AddArtist(artist3, role1);
                comicbook3.AddArtist(artist1, role2);

                context.ComicBooks.Add(comicbook1);
                context.ComicBooks.Add(comicbook2);
                context.ComicBooks.Add(comicbook3);
                context.SaveChanges();
            }

            ComicbookRepository CbRepo    = new ComicbookRepository();
            var       ComicBooksList      = CbRepo.GetComicBooks().ToList();
            ComicBook TestUpdateComicBook = null;

            foreach (ComicBook cb in ComicBooksList)
            {
                Console.WriteLine("Series Title: {0}", cb.Id);

                if (cb.Id == 1)
                {
                    TestUpdateComicBook = cb;
                }
            }
            CbRepo.UpdateComicBooks(TestUpdateComicBook);

            Console.ReadLine();
        }
Exemplo n.º 5
0
        protected override void Seed(Context context)
        {
            var series1 = new Series()
            {
                Title = "The amazing Spider-Man"
            };

            var series2 = new Series()
            {
                Title = "The Invincible Iron-Man"
            };

            var artist1 = new Artist()
            {
                Name = "Stan Lee"
            };

            var artist2 = new Artist()
            {
                Name = "Graham Chukwumaobi"
            };

            var artist3 = new Artist()
            {
                Name = "Steve Dicko"
            };

            var role1 = new Role()
            {
                Name = "Script"
            };

            var role2 = new Role()
            {
                Name = "Pencil"
            };

            var comicBook1 = new ComicBook()
            {
                Series      = series1,
                IssueNumber = 1,
                PublishedOn = DateTime.Today
            };

            comicBook1.AddArtist(artist1, role1);
            comicBook1.AddArtist(artist2, role2);

            var comicBook2 = new ComicBook()
            {
                Series      = series1,
                IssueNumber = 2,
                PublishedOn = DateTime.Today
            };

            comicBook2.AddArtist(artist1, role1);
            comicBook2.AddArtist(artist2, role2);

            var comicBook3 = new ComicBook()
            {
                Series      = series2,
                IssueNumber = 3,
                PublishedOn = DateTime.Today
            };

            comicBook3.AddArtist(artist2, role1);
            comicBook3.AddArtist(artist3, role2);

            context.ComicBooks.Add(comicBook1);
            context.ComicBooks.Add(comicBook2);
            context.ComicBooks.Add(comicBook2);
            context.SaveChanges();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            using (var context = new Context())
            {
                var series1 = new Series()
                {
                    Title = "The Amazing Spiderman"
                };
                var series2 = new Series()
                {
                    Title = "The invincible Iron Man"
                };

                var artist1 = new Artist()
                {
                    Name = "Stan Lee"
                };
                var artist2 = new Artist()
                {
                    Name = "Steve Ditko"
                };
                var artist3 = new Artist()
                {
                    Name = "Jack Kirby"
                };

                var role1 = new Role()
                {
                    Name = "script"
                };
                var role2 = new Role()
                {
                    Name = "pencils"
                };

                var comicBook1 = new ComicBook()
                {
                    Series      = series1,
                    IssueNumber = 1,
                    PublishedOn = DateTime.Today
                };
                comicBook1.AddArtist(artist1, role1);
                comicBook1.AddArtist(artist2, role2);

                var comicBook2 = new ComicBook()
                {
                    Series      = series1,
                    IssueNumber = 2,
                    PublishedOn = DateTime.Today
                };
                comicBook2.AddArtist(artist1, role1);
                comicBook2.AddArtist(artist2, role2);
                var comicBook3 = new ComicBook()
                {
                    Series      = series2,
                    IssueNumber = 1,
                    PublishedOn = DateTime.Today
                };
                comicBook3.AddArtist(artist1, role1);
                comicBook3.AddArtist(artist3, role2);

                context.ComicBooks.Add(comicBook1);
                context.ComicBooks.Add(comicBook2);
                context.ComicBooks.Add(comicBook3);
                context.SaveChanges();

                var comicBooks = context.ComicBooks
                                 .Include(cb => cb.Series)
                                 .Include(cb => cb.Artists.Select(a => a.Artist))
                                 .Include(cb => cb.Artists.Select(a => a.Role))
                                 .ToList();
                foreach (var comicBook in comicBooks)
                {
                    var artistRoleNames = comicBook.Artists
                                          .Select(a => $"{a.Artist.Name} - {a.Role.Name}").ToList();
                    var artistsRolesDisplayText = string.Join(", ", artistRoleNames);

                    Console.WriteLine(comicBook.DisplayText);
                    Console.WriteLine(artistsRolesDisplayText);
                }

                Console.ReadLine();
            }
        }
Exemplo n.º 7
0
        protected override void Seed(ComicBookGalleryModel.Data.Context context)
        {
            const int roleIdScript  = 1;
            const int roleIdPencils = 2;

            context.Roles.AddOrUpdate(
                r => r.Id,
                new Role()
            {
                Id = roleIdScript, Name = "Script"
            },
                new Role()
            {
                Id = roleIdPencils, Name = "Pencils"
            }
                );
#if DEBUG
            const int artistIdStanLee    = 1;
            const int artistIdSteveDitko = 2;

            context.Artists.AddOrUpdate(
                a => a.Id,
                new Artist()
            {
                Id = artistIdStanLee, Name = "Stan Lee"
            },
                new Artist()
            {
                Id = artistIdSteveDitko, Name = "Steve Ditko"
            }
                );

            const int seriesIdSpiderMan = 1;

            context.Series.AddOrUpdate(
                s => s.Id,
                new Series()
            {
                Id          = seriesIdSpiderMan,
                Title       = "The Amazing Spider-Man",
                Description = "The Amazing Spider-Man (abbreviated as ASM) is an American comic book series published by Marvel Comics, featuring the adventures of the fictional superhero Spider-Man. Being the mainstream continuity of the franchise, it began publication in 1963 as a monthly periodical and was published continuously, with a brief interruption in 1995, until its relaunch with a new numbering order in 1999. In 2003 the series reverted to the numbering order of the first volume. The title has occasionally been published biweekly, and was published three times a month from 2008 to 2010. A film named after the comic was released July 3, 2012."
            }
                );

            var comicBook1 = new ComicBook()
            {
                Id            = 1,
                SeriesId      = seriesIdSpiderMan,
                IssueNumber   = 1,
                Description   = "As Peter Parker and Aunt May struggle to pay the bills after Uncle Bens death, Spider-Man must try to save a doomed John Jameson from his out of control spacecraft. / Spideys still trying to make ends meet so he decides to try and join the Fantastic Four. When that becomes public knowledge the Chameleon decides to frame Spider-Man and steals missile defense plans disguised as Spidey.",
                PublishedOn   = new DateTime(1963, 3, 1),
                AverageRating = 7.1m
            };
            comicBook1.AddArtist(artistIdStanLee, roleIdScript);
            comicBook1.AddArtist(artistIdSteveDitko, roleIdPencils);

            context.ComicBooks.AddOrUpdate(
                cb => cb.Id,
                comicBook1
                );

            var comicBook2 = new ComicBook()
            {
                Id            = 2,
                SeriesId      = seriesIdSpiderMan,
                IssueNumber   = 2,
                Description   = "The Vulture becomes the city's most feared thief. Spider-Man must find a way to figure out his secrets and defeat this winged menace. / Spider-Man is up against The Tinkerer and a race of aliens who are trying to invade Earth.",
                PublishedOn   = new DateTime(1963, 5, 1),
                AverageRating = 6.8m
            };
            comicBook2.AddArtist(artistIdStanLee, roleIdScript);
            comicBook2.AddArtist(artistIdSteveDitko, roleIdPencils);

            context.ComicBooks.AddOrUpdate(
                cb => cb.Id,
                comicBook2
                );

            var comicBook3 = new ComicBook()
            {
                Id            = 3,
                SeriesId      = seriesIdSpiderMan,
                IssueNumber   = 3,
                Description   = "Spider-Man battles Doctor Octopus and is defeated, he considers himself a failure until the Human Torch gives a speech to his class which inspires him to go in prepared and win the day, leaving Doctor Octopus under arrest. Spider-Man visits the Torch with words of thanks.",
                PublishedOn   = new DateTime(1963, 7, 1),
                AverageRating = 6.9m
            };
            comicBook3.AddArtist(artistIdStanLee, roleIdScript);
            comicBook3.AddArtist(artistIdSteveDitko, roleIdPencils);

            context.ComicBooks.AddOrUpdate(
                cb => cb.Id,
                comicBook3
                );
#endif
        }