Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, FleetManagerContext apiContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();

            try
            {
                using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>()
                                          .CreateScope())
                {
                    Installer.Configure(serviceScope);
                    //serviceScope.ServiceProvider.GetService<ISeedService>().SeedDatabase().Wait();
                }
            }
            catch (System.Exception ex)
            {
                // I'm using Serilog here, but use the logging solution of your choice.
                throw ex;
            }
            // for adding some test data
            //AddTestData(apiContext);
        }
 public VehicleNavigatorViewModel(FleetManagerContext fleetManagerContext)
 {
     _fleetManagerContext = fleetManagerContext;
     _fleets = _fleetManagerContext.Fleets;
     _fleetManagerContext.FleetLoaded += (sender, args) =>
     {
         Fleets = fleetManagerContext.Fleets;
     };
     if (!_fleetManagerContext.IsLoaded)
     {
         _fleetManagerContext.LoadAsync();
     }
 }
Esempio n. 3
0
 public CarService(FleetManagerContext context)
 {
     _context = context;
 }