Example #1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseMvc();
            using (var context = new PortfolioEntities())
            {
                context.Database.EnsureCreated();

                if (context.Projects.Count() == 0)
                {
                    context.Seed(context);
                }
            }
        }