Exemplo n.º 1
0
        public static void SeedPPGDataContext(this ApiDBContext context)
        {
            var ppgs = new List <Ppg>()
            {
                new Ppg()
                {
                    heartRate    = 100,
                    time         = new DateTime(1990, 1, 1),
                    greenCount1  = 1,
                    greenCount2  = 1,
                    xAccel       = 1,
                    yAccel       = 1,
                    zAccel       = 1,
                    hrConfidence = 1
                },
                new Ppg()
                {
                    heartRate    = 101,
                    time         = new DateTime(1990, 2, 2),
                    greenCount1  = 2,
                    greenCount2  = 2,
                    xAccel       = 2,
                    yAccel       = 2,
                    zAccel       = 2,
                    hrConfidence = 2
                }
            };

            context.ppg.AddRange(ppgs);
            context.SaveChanges();
        }
Exemplo 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, ApiDBContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});



            //used for insert test in development envirment
            //context.SeedTempDataContext();
            //context.SeedPPGDataContext();


            app.UseMvc();


            //enable ui
            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "MyAPI V1");
                c.RoutePrefix = string.Empty;
            });
        }
Exemplo n.º 3
0
        public static void SeedTempDataContext(this ApiDBContext context)
        {
            var temps = new List <Temp>()
            {
                new Temp()
                {
                    temp = 1.1f,
                    time = new DateTime(1990, 1, 1)
                },
                new Temp()
                {
                    temp = 2.2f,
                    time = new DateTime(1990, 2, 2)
                }
            };

            context.temp.AddRange(temps);
            context.SaveChanges();
        }