public static void Init(ProjetoEvolucionalDataContext context)
        {
            context.Database.EnsureCreated();

            if (!context.Usuarios.Any())
            {
                context.Usuarios.Add(new Models.Usuario
                {
                    Nome  = "Candidato Evolucional",
                    Login = "******",
                    Senha = "123456"
                });

                context.SaveChanges();
            }
        }
Esempio 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, Data.ProjetoEvolucionalDataContext ctx)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                Data.DbInitializer.Init(ctx);
            }

            app.UseStaticFiles();

            app.UseAuthentication();
            app.UseMvcWithDefaultRoute();

            app.Run(async(context) =>
            {
                context.Response.StatusCode = 404;
                await context.Response.WriteAsync("Recurso não encontrado!");
            });
        }