Ejemplo n.º 1
0
        public QuestionController(IStartupTimeStore store, IDatabaseHandler db, IServiceCommunication srvCom)
        {
            Store   = store;
            _db     = db;
            _srvCom = srvCom;

            if (_question == null)
            {
                var dbQuestion = _db.GetQuestion();
                _question      = new Question(dbQuestion);
                _rightAnswerId = dbQuestion.RightAnswerIndex;
            }
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IStartupTimeStore store, IDatabaseHandler db, IServiceCommunication srvCom)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "QuestionService v1"));
            }

            store.Initialize();
            db.EnsureCreated();

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }