public void ConfigureServices(IServiceCollection services) { services.AddControllers(); // DBContext services.AddDatabaseSetup(Configuration); // DI DI.RegisterServices(services); // AutoMapper services.AddAutoMapper(typeof(MappingProfile)); // CORS services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); }); // JWT JWTSetup.AddJWTSetup(services, Configuration); }
public AuthController( ApplicationDbContext db, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IOptions <JWTSetup> jwtSetup ) : base(db) { _userManager = userManager; _signInManager = signInManager; _jwtSetup = jwtSetup.Value; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); SwaggerSetup.ConfigureServices(services); CorsSetup.ConfigureServices(services); EntityFrameWorkSetup.ConfigurationServices(services, Configuration); DependencyInjectionSetup.ConfigureServices(services); JWTSetup.ConfigureServices(services, Configuration); AutoMapperSetup.ConfigureServices(services); }