Beispiel #1
0
        protected override async Task ExecuteAsync(CancellationToken cToken)
        {
            while (!cToken.IsCancellationRequested)
            {
                System.Console.WriteLine("+ + +");

                var response = await restClient.GetAsync(icndbUrl, cToken);

                if (response.IsSuccessStatusCode)
                {
                    var fact = await response.Content.ReadAsStringAsync();

                    Console.WriteLine(fact);
                    var ktphn = JsonSerializer.Deserialize <List <Kutuphane> >(fact);



                    using (var db = new KutuphaneContext()){
                        db.Kutuphanes.AddRange(ktphn);
                        db.SaveChanges();
                    }
                }

                await Task.Delay(TimeSpan.FromSeconds(10), cToken);
            }
        }
Beispiel #2
0
        protected override void Init()
        {
            var builder = new KutuphaneContext();

            ServiceIoC.Container.Register(Component.For <KutuphaneContext>()
                                          .LifeStyle
                                          .PerWebRequest
                                          .UsingFactoryMethod(k => new KutuphaneContext()).LifeStyle.Singleton);
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, KutuphaneContext kutuphaneContext)
        {
            if (env.IsDevelopment())
            {
                var a = kutuphaneContext.Database.EnsureCreated();
                kutuphaneContext.Database.Migrate();


                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
 public KitapManager()
 {
     kutuphaneContext = new KutuphaneContext();
 }
Beispiel #5
0
 public YazarManager()
 {
     kutuphaneContext = new KutuphaneContext();
 }
 public UyeManager()
 {
     kutuphaneContext = new KutuphaneContext();
 }