Exemplo n.º 1
0
 public static async Task EnsureSeedData(this BollywoodDbContext db)
 {
     if (!db.Movies.Any())
     {
         db.Movies.AddRange(new DbUtility().GetMovies());
         await db.SaveChangesAsync().ConfigureAwait(false);
     }
 }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, BollywoodDbContext db)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors("CorsPolicy");
            app.UseMvc();
            db.EnsureSeedData().GetAwaiter().GetResult();
        }
Exemplo n.º 3
0
 public MovieRepository(BollywoodDbContext bollywoodDbContext)
 {
     _bollywoodDbContext = bollywoodDbContext;
 }