Beispiel #1
0
        public void AddMovies()
        {
            var          dbContext = new BookShelfContext();
            List <Movie> movies    = GetMovies();

            dbContext.Movies.AddRange(movies);

            dbContext.SaveChanges();
        }
Beispiel #2
0
        public void AddCharacters()
        {
            var dbContext = new BookShelfContext();
            List <Character> characters = GetCharacters();

            dbContext.Characters.AddRange(characters);

            dbContext.SaveChanges();
        }
Beispiel #3
0
        public void GetMoviesFromDb()
        {
            var dbContext = new BookShelfContext();
            var movies    = dbContext.Movies;

            foreach (var c in movies)
            {
                Console.WriteLine($"Id: {c.Id},  \tName: {c.Name}  " +
                                  $"\tGenre: {c.Genre} \tYear: {c.Year}");
            }
        }
Beispiel #4
0
        public void GetCharactersFromDb()
        {
            var dbContext  = new BookShelfContext();
            var characters = dbContext.Characters;

            foreach (var c in characters)
            {
                Console.WriteLine($"Id: {c.Id},  \tFirstName: {c.FirstName}  " +
                                  $"\tLastName: {c.LastName}  \tGender: {c.Gender}  \tAge: {c.Age}");
            }
        }