Exemplo n.º 1
0
        private static void TestEntityFrameworkCore()
        {
            using (var context = new ProjectVContext())
            {
                var tmdbMovie = new TmdbMovieInfo(
                    thingId:     1,
                    title:       "Test",
                    voteCount:   100,
                    voteAverage: 10.0,
                    overview:    "Overview",
                    releaseDate: DateTime.UtcNow,
                    popularity:  50.0,
                    adult:       true,
                    genreIds:    new List <int> {
                    1, 2, 4
                },
                    posterPath:  "None"
                    );

                context.Add(tmdbMovie);

                int count = context.SaveChanges();
                Console.WriteLine($"{count.ToString()} records saved to database.");
            }

            using (var context = new ProjectVContext())
            {
                foreach (TmdbMovieInfo tmdbMovie in context.TmdbMovies)
                {
                    Console.WriteLine(
                        $"TMDB movie: {tmdbMovie.ThingId.ToString()}, {tmdbMovie.Title}, " +
                        $"{tmdbMovie.Popularity.ToString()}"
                        );
                }
            }
        }
Exemplo n.º 2
0
 public PostRepository(ProjectVContext context)
 {
     _context = context;
 }
Exemplo n.º 3
0
 public AccountService(ProjectVContext context, ITokenService tokenService)
 {
     _context      = context;
     _tokenService = tokenService;
 }
Exemplo n.º 4
0
 public UserRepository(ProjectVContext context)
 {
     _context = context;
 }