Exemplo n.º 1
0
 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();
     }
 }
Exemplo n.º 2
0
 public UserRepository(SerHumanoContext context) : base(context)
 {
 }
Exemplo n.º 3
0
        // 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);
        }
Exemplo n.º 4
0
 protected AbstractRepository(SerHumanoContext context)
 {
     Context = context;
 }