public void ConfigureServices(IServiceCollection services) { var config = new MongoDBConfig(); Configuration.Bind(config); var appUsersContext = new AppUserContext(config); var repo = new AppUserRepository(appUsersContext); services.AddSingleton <AppUserRepository>(repo); var planContext = new ServicePlanContext(config); var planrepo = new ServicePlanRepository(planContext); services.AddSingleton <ServicePlanRepository>(planrepo); services.AddControllers(); services.AddCors(options => { options.AddPolicy(MyAllowSpecificOrigins, builder => { builder.WithOrigins("http://localhost:4200") .AllowAnyHeader() .AllowAnyMethod(); }); }); }
public PlansController(ServicePlanRepository repo) { _repo = repo; }