Ejemplo n.º 1
0
        public async Task Initialize(TVShowDbContext context)
        {
            context.GenreItems.Add(new GenreEntity()
            {
                Genre = "Comedy"
            });
            context.GenreItems.Add(new GenreEntity()
            {
                Genre = "Horror"
            });
            context.GenreItems.Add(new GenreEntity()
            {
                Genre = "Drama"
            });
            context.GenreItems.Add(new GenreEntity()
            {
                Genre = "Mystery"
            });
            context.TVShowItems.Add(new TVShowEntity()
            {
                Title = "True Detective", ImdbScore = 9.0
            });
            context.TVShowItems.Add(new TVShowEntity()
            {
                Title = "Killing Eve", ImdbScore = 8.3
            });
            context.TVShowItems.Add(new TVShowEntity()
            {
                Title = "The Haunting of Hill House", ImdbScore = 8.7
            });
            context.TVShowItems.Add(new TVShowEntity()
            {
                Title = "Sex Education", ImdbScore = 8.3
            });
            context.TVShowItems.Add(new TVShowEntity()
            {
                Title = "Dark", ImdbScore = 8.7
            });
            TVShowEntity TVShow = context.TVShowItems.Where(x => x.Title == "Sex Education").FirstOrDefault();

            context.TVShowGenreItems.Add(new TVShowGenre()
            {
                Genre = context.GenreItems.Where(x => x.Genre == "Comedy").FirstOrDefault(), TVShow = context.TVShowItems.Where(x => x.Title == "Sex Education").FirstOrDefault()
            });
            context.TVShowGenreItems.Add(new TVShowGenre()
            {
                TVShowId = 2, GenreId = 3
            });

            await context.SaveChangesAsync();
        }
Ejemplo n.º 2
0
 public TVShowSqlRepo(TVShowDbContext context, ITVShowGenres tvgenres)
 {
     _context = context;
     _random  = new Random();
     _tvgenre = tvgenres;
 }
Ejemplo n.º 3
0
 public GenreSqlRepo(TVShowDbContext context)
 {
     _context = context;
 }