Esempio n. 1
0
 public static void SeedData(ApiDBContex msgDB)
 {
     msgDB.Messages.Add(new Message {
         Id = "1", Owner = "Tim", Text = "What\'s up"
     });
     msgDB.Messages.Add(new Message {
         Id = "2", Owner = "John", Text = "Hello"
     });
     msgDB.Messages.Add(new Message {
         Id = "3", Owner = "Rose", Text = "Hello guys"
     });
     msgDB.Users.Add(new User {
         FirstName = "Henry", Email = "a", Password1 = "a"
     });
     msgDB.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, ApiDBContex apiDBContex)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();



            app.UseCors("Cors");
            app.UseMvc();

            SeedData(apiDBContex);
        }