// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSwagger(); // configuring connection to PGCare database services.Configure <Settings>( options => { options.ConnectionString = Configuration.GetSection("MongoDb:ConnectionString").Value; options.Database = Configuration.GetSection("MongoDb:Database").Value; }); // var settings = Configuration.GetSection("Root:MongoDB").Get<Settings>(); services.Configure <Settings>(options => Configuration.GetSection("MongoDB").Bind(options)); //db context services.AddSingleton <IPGCareContext, PGCareContext>(); var db = new PGCareContext(Configuration["MongoDB:ConnectionString"], Configuration["MongoDB:Database"]); //doctor services services.AddScoped <IAddUpdateDoctor>(s => new AddUpdateDoctor(db)); services.AddScoped <IDeleteDoctor>(s => new DeleteDoctor(db)); services.AddScoped <IGetDoctorDetail>(s => new GetDoctorDetail(db)); services.AddScoped <IGetDoctorsList>(s => new GetDoctorsList(db)); }
public GetDoctorsList(PGCareContext db) { _db = db; }
public GetDoctorDetail(PGCareContext db) { _db = db; }
public ValidateDoctorExistsFilterImpl(PGCareContext dbContext) { _dbContext = dbContext; }