Esempio n. 1
0
        public void AddBookShelf()
        {
            var book       = new BookShelfContext();
            var characters = CinemaService.GetCharacters();

            foreach (var charactert in characters)
            {
                book.Characters.Add(charactert);
            }
            book.SaveChanges();
        }
Esempio n. 2
0
        public void AddMovies()
        {
            var book = new BookShelfContext();

            var movie = new Movie()
            {
                Id = 1, Name = "Star Wars", Genre = "science fiction", Year = 1999
            };

            book.Movies.Add(movie);
            book.SaveChanges();
            Console.WriteLine($"Movie: {movie.Name} added");
        }
Esempio n. 3
0
        public void AddCharacterBookShelf()
        {
            var book         = new BookShelfContext();
            var characterOne = new Character()
            {
                FirstName = "Dale", LastName = "Cooper", Gender = true, Age = 27
            };
            var characterTwo = new Character()
            {
                FirstName = "Laura", LastName = "Palmer", Gender = true, Age = 19
            };

            book.Characters.AddRange(new Character[] { characterOne, characterTwo });
            book.SaveChanges();
            Console.WriteLine($"Characters {characterOne.FirstName},{characterTwo.FirstName} added");
        }