public CustomerController(FiscalContext context, ICustomerCount customerCount, ILogger <CustomerController> logger) { _dbcontext = context; _customerCount = customerCount; _logger = logger; _logger.LogDebug("In constructor."); }
// 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}"); }); }
public void Add <T>(ICollection <T> items) where T : class { using (FiscalContext context = new FiscalContext()) { context.Set <T>().AddRange(items); context.SaveChanges(); } }
public void Add <T>(T item) where T : class { using (FiscalContext context = new FiscalContext()) { context.Set <T>().Add(item); context.SaveChanges(); } }
public List <T> Load <T>() where T : class { using (FiscalContext context = new FiscalContext()) { List <T> result = context.Set <T>().ToList(); return(result); } }
// 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(); }); }
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; } } }
// 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(); }); }
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?}"); }); }
public ProductNumber(FiscalContext context) { _context = context; Number = _context.Products.Count(); }
public ProductController(FiscalContext context) { _context = context; }
public ProductController(FiscalContext dbcontext, IMemoryCache memoryCache) { _dbcontext = dbcontext; _memoryCache = memoryCache; }
public HomeController(ILogger <HomeController> logger, FiscalContext context) { _logger = logger; _context = context; }
public ProductController(FiscalContext context, IProductNumber productNumber) { _context = context; _productNumber = productNumber; }
public CustomerController(FiscalContext context) { _context = context; }
public InvoiceController(FiscalContext context) { _context = context; }
public CustomerCountService(FiscalContext context) { _number = context.Customers.Count(); }