This commit is contained in:
mmrbnjd
2024-03-30 15:10:36 +03:30
parent f4588f3426
commit a9e3afdea4
60 changed files with 1752 additions and 70 deletions

View File

@@ -1,3 +1,9 @@
using Back.Data.Contracts;
using Back.Data.Infrastructure.Repository;
using Back.Services;
using Microsoft.EntityFrameworkCore;
using TaxPayer.Infrastructure.Persistence;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
@@ -6,6 +12,23 @@ builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<SqlDbContext>(options =>
{
options.UseSqlServer(builder.Configuration.GetConnectionString("Base"));
});
builder.Services.AddScoped(typeof(IAsyncRepository<>), typeof(RepositoryBase<>));
builder.Services.AddScoped<Back.Services.ServBase>();
string origins = "OriginTaxPayer";
builder.Services.AddCors(options =>
{
options.AddPolicy(origins,
policy =>
{
policy.WithOrigins("http://localhost:5107")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
var app = builder.Build();
@@ -17,7 +40,7 @@ if (app.Environment.IsDevelopment())
}
app.UseHttpsRedirection();
app.UseCors(origins);
app.UseAuthorization();
app.MapControllers();