public static List <Subclasificacion> getSubclasificacionData(FinancecalcDBContext c) => new List <Subclasificacion> { new Subclasificacion { Code = -1, Name = "na", Clasification = c.Clasificacion.Single(i => i.Code == -1) }, new Subclasificacion { Code = 1100, Name = "activo circulante", Clasification = c.Clasificacion.Single(i => i.Code == 1000) }, new Subclasificacion { Code = 1200, Name = "activo fijo", Clasification = c.Clasificacion.Single(i => i.Code == 1000) }, new Subclasificacion { Code = 1300, Name = "activo diferido", Clasification = c.Clasificacion.Single(i => i.Code == 1000) }, new Subclasificacion { Code = 1400, Name = "otros activos", Clasification = c.Clasificacion.Single(i => i.Code == 1000) }, new Subclasificacion { Code = 2100, Name = "pasivo circulante", Clasification = c.Clasificacion.Single(i => i.Code == 2000) }, new Subclasificacion { Code = 2200, Name = "pasivo no circulante", Clasification = c.Clasificacion.Single(i => i.Code == 2000) } };
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } //app.UseHttpsRedirection(); app.Use(async(context, next) => { if (!context.Request.Path.Equals("/api/acceso/acceder")) { if (context.Request.Headers.ContainsKey("Authorization") && context.Request.Headers.ContainsKey("User")) { string auth = context.Request.Headers["Authorization"]; string usr = context.Request.Headers["User"]; IServiceScope scope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope(); FinancecalcDBContext _db = scope.ServiceProvider.GetService <FinancecalcDBContext>(); Usuario _user = _db.Usuario.Find(new Guid(usr)); UserToken _realTkn = new UserToken(_user); if (!auth.Equals(_realTkn._token)) { context.Abort(); } } else { context.Abort(); } } await next.Invoke(); }); app.UseMvc(); // Initialization of tables values new InitValues(app.ApplicationServices) .ClasificacionValues() .SubclasificacionValues(); }
public InitValues(IServiceProvider serviceProvider) { IServiceScope scope = serviceProvider.GetService <IServiceScopeFactory>().CreateScope(); this.context = scope.ServiceProvider.GetService <FinancecalcDBContext>(); }
public AccesoController(FinancecalcDBContext context) => this.context = context;
public CuentaController(FinancecalcDBContext context) => this.context = context;
public SubclasificacionController(FinancecalcDBContext context) => this.context = context;