public static void Initialize(SerHumanoContext context) { context.Database.EnsureCreated(); // Look for any students. if (!context.PersonTypes.Any()) { context.PersonTypes.Add(new PersonType { Description = "Visitante" }); context.PersonTypes.Add(new PersonType { Description = "Profissional" }); context.PersonTypes.Add(new PersonType { Description = "Instituição" }); context.PersonTypes.Add(new PersonType { Description = "Administrador" }); context.SaveChanges(); } if (!context.Users.Any()) { context.Users.Add(new User { Email = "*****@*****.**", Password = "******", Person = new Common.Models.Persons.Person { Cadastro = DateTime.Now, Name = "Ramon Quirino da Silva", PersonType = context.PersonTypes.First(x => x.Description == "Administrador") } }); context.SaveChanges(); } }
public UserRepository(SerHumanoContext context) : base(context) { }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, SerHumanoContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseApplicationInsightsRequestTelemetry(); app.UseApplicationInsightsExceptionTelemetry(); app.UseMvc(); DbInitializer.Initialize(context); }
protected AbstractRepository(SerHumanoContext context) { Context = context; }