Esempio n. 1
0
 public CustomerController(FiscalContext context, ICustomerCount customerCount, ILogger <CustomerController> logger)
 {
     _dbcontext     = context;
     _customerCount = customerCount;
     _logger        = logger;
     _logger.LogDebug("In constructor.");
 }
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, IWebHostEnvironment env, FiscalContext context)
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            app.UseStaticFiles(new StaticFileOptions()
            {
                RequestPath = "/wwwroot"
            });

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "StaticFolder")),
                RequestPath  = "/staticfiles"
            });

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id=50}");
            });
        }
Esempio n. 3
0
 public void Add <T>(ICollection <T> items) where T : class
 {
     using (FiscalContext context = new FiscalContext())
     {
         context.Set <T>().AddRange(items);
         context.SaveChanges();
     }
 }
Esempio n. 4
0
 public void Add <T>(T item) where T : class
 {
     using (FiscalContext context = new FiscalContext())
     {
         context.Set <T>().Add(item);
         context.SaveChanges();
     }
 }
Esempio n. 5
0
 public List <T> Load <T>() where T : class
 {
     using (FiscalContext context = new FiscalContext())
     {
         List <T> result = context.Set <T>().ToList();
         return(result);
     }
 }
Esempio n. 6
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, FiscalContext fiscalContext)
        {
            //fiscalContext.Database.EnsureDeleted();
            //fiscalContext.Database.EnsureCreated();

            app.UseStaticFiles(new StaticFileOptions()
            {
                RequestPath = "/root"
            });

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "StaticFolder")),
                RequestPath  = "/static"
            });

            //app.Use(async (context, next) => {
            //    await context.Response.WriteAsync($"Path is: {context.Request.Path.Value}   ");
            //    await next.Invoke();
            //});

            app.Map("/map", (aplicationBuilder) => {
                aplicationBuilder.Use(async(c, next) => {
                    await c.Response.WriteAsync("Inside use middleware, in map");
                    await next.Invoke();
                });

                //aplicationBuilder.Run(async (c) => {
                //    await c.Response.WriteAsync("Inside run middleware, in map");
                //});
            });

            //app.Run(async (context) => {
            //    await context.Response.WriteAsync("Inside run middleware, not in map! ");
            //});

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Esempio n. 7
0
 public void Delete <T>(T item) where T : class
 {
     using (FiscalContext context = new FiscalContext())
     {
         if (item is IIdentifier)
         {
             T element = context.Set <T>().Find(((IIdentifier)item).ID);
             context.Set <T>().Remove(element);
             context.SaveChanges();
         }
         else
         {
             return;
         }
     }
 }
Esempio n. 8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, FiscalContext dbcontext)
        {
            dbcontext.Database.EnsureDeleted();
            dbcontext.Database.EnsureCreated();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints => {
                endpoints.MapControllers();
            });
        }
Esempio n. 9
0
        public void Configure(IApplicationBuilder app, FiscalContext context, ILogger <Startup> logger, UserManager <AppUser> userManager, RoleManager <IdentityRole> roleManager, SignInManager <AppUser> signInManager, IWebHostEnvironment environment)
        {
            //context.Database.EnsureDeleted();
            if (context.Database.EnsureCreated())
            {
                SeedUsersAndRoles.CreateInitialUsers(userManager, roleManager, signInManager);
            }

            app.UseStaticFiles();

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(environment.ContentRootPath, "node_modules")),
                RequestPath  = "/node_modules"
            });

            app.UseNodeModules();

            //app.UseCookiePolicy();
            app.UseSession();

            app.UseCors();

            app.UseAuthentication();

            if (_env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseSignalR(hubRootBuilder => {
                hubRootBuilder.MapHub <ChatHub>("/chathub");
            });

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints => {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Esempio n. 10
0
 public ProductNumber(FiscalContext context)
 {
     _context = context;
     Number   = _context.Products.Count();
 }
Esempio n. 11
0
 public ProductController(FiscalContext context)
 {
     _context = context;
 }
Esempio n. 12
0
 public ProductController(FiscalContext dbcontext, IMemoryCache memoryCache)
 {
     _dbcontext   = dbcontext;
     _memoryCache = memoryCache;
 }
Esempio n. 13
0
 public HomeController(ILogger <HomeController> logger, FiscalContext context)
 {
     _logger  = logger;
     _context = context;
 }
Esempio n. 14
0
 public ProductController(FiscalContext context, IProductNumber productNumber)
 {
     _context       = context;
     _productNumber = productNumber;
 }
Esempio n. 15
0
 public CustomerController(FiscalContext context)
 {
     _context = context;
 }
Esempio n. 16
0
 public InvoiceController(FiscalContext context)
 {
     _context = context;
 }
Esempio n. 17
0
 public CustomerCountService(FiscalContext context)
 {
     _number = context.Customers.Count();
 }