// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, DinDinSpinDbContext dbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // 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.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseGraphQL <DinDinSpinSchema>(); app.UseGraphQLPlayground(new GraphQLPlaygroundOptions()); //to explorer API navigate https://*DOMAIN*/ui/playground app.UseHttpsRedirection(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "api/{controller}/{action=Index}/{id?}"); }); app.UseSignalR(routes => { routes.MapHub <SignalRCounter>("/signalr"); }); app.UseSpa(spa => { spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseReactDevelopmentServer(npmScript: "start"); } }); InitializeMapper(); }
public DinnerRepository(DinDinSpinDbContext dbContext) { _dbContext = dbContext; if (_dbContext.Dinners.Any()) { return; } var spinId = Guid.NewGuid(); var spinner = new Spinner("Fam Jer") { Id = spinId, Dinners = new List <Dinner>() { new Dinner("Tacopaj", DateTime.Now) { SpinnerId = spinId, MainIngredient = new Ingredient("Sak") }, new Dinner("Truck", DateTime.Now) { SpinnerId = spinId, MainIngredient = new Ingredient("Majs") }, new Dinner("AGV", DateTime.Now) { SpinnerId = spinId, MainIngredient = new Ingredient("Oil") } } }; _dbContext.Spinners.Add(spinner); _dbContext.SaveChanges(); }