Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, RelibreContext context)
        {
            // context.Database.Migrate();

            // var supportedCultures = "pt-BR";
            // var localizationOptions = new RequestLocalizationOptions()
            //     .SetDefaultCulture(supportedCultures)
            //     .AddSupportedCultures(supportedCultures)
            //     .AddSupportedUICultures(supportedCultures);

            // app.UseRequestLocalization(localizationOptions);

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Relibre Api");
            });

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

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseCors("policy");

            app.UseExceptionHandler(x =>
            {
                x.Run(
                    async context =>
                {
                    context.Response.StatusCode  = (int)HttpStatusCode.InternalServerError;
                    context.Response.ContentType = Constants.DefaultContentType;
                    var exception = context.Features.Get <IExceptionHandlerFeature>();

                    if (exception != null)
                    {
                        await context.Response.WriteAsync(
                            Util.ReturnException((Exception)exception).ToString())
                        .ConfigureAwait(false);
                    }
                });
            });

            app.UseAuthentication();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Exemplo n.º 2
0
 public BookRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
 public NotificationPersonRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
Exemplo n.º 4
0
 public UnitOfWork(RelibreContext context)
 {
     _context = context;
 }
Exemplo n.º 5
0
 public UserRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
Exemplo n.º 6
0
 public ContactRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
Exemplo n.º 7
0
 public EmailVerificationRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
Exemplo n.º 8
0
 public AuthorRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
 public SubscriptionRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
Exemplo n.º 10
0
 public TypeRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
Exemplo n.º 11
0
 public ProfileRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
Exemplo n.º 12
0
 public LibraryRepository(
     RelibreContext context
     )
 {
     _context = context;
 }
Exemplo n.º 13
0
 public CategoryRepository(
     RelibreContext context
     )
 {
     _context = context;
 }