예제 #1
0
 public static void PopulateData(this EmployeePlatformContext db)
 {
     _db = db;
     PopulateUser();
     PopulateIdentificationTypes();
     PopulateAreas();
     PopulateEmployees();
 }
예제 #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, EmployeePlatformContext db)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                db.PopulateData();
            }
            app.UseExceptionHandler(builder =>
            {
                builder.Run(
                    async context =>
                {
                    context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                    context.Response.Headers.Add("Access-Control-Allow-Origin", "*");

                    var error = context.Features.Get <IExceptionHandlerFeature>();
                    if (error != null)
                    {
                        context.Response.AddApplicationError(error.Error.Message);
                        await context.Response.WriteAsync(error.Error.Message).ConfigureAwait(false);
                    }
                });
            });

            app.UseCors(options => options.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin());
            app.UseAuthentication();
            app.UseGraphQL <EmployeePlatformSchema>("/graphql");
            app.UseGraphQLPlayground(new GraphQLPlaygroundOptions());
            app.UseHttpsRedirection();
            app.UseRouting();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
예제 #3
0
 public AreaRepository(EmployeePlatformContext db)
 {
     _db = db;
 }
예제 #4
0
 public PaginationRepository(EmployeePlatformContext db)
 {
     _db = db;
 }
 public IdentificationTypeRepository(EmployeePlatformContext db)
 {
     _db = db;
 }