/// <summary> /// /// </summary> /// <param name="_unitOfWork"></param> /// <param name="manager"></param> /// <param name="loggerFactory"></param> public ResponderService(IUnitOfWork _unitOfWork, IQuestionTypeManager manager, ILoggerFactory loggerFactory) { this._unitOfWork = _unitOfWork; this._questionTypeManager = manager; _loggerFactory = loggerFactory; _logger = loggerFactory.CreateLogger <ResponderService> (); }
/// <summary> /// Constructor the controller. /// </summary> /// <param name="unitOfWork">Unit of work service.</param> /// <param name="questionTypeManager">Question type manager service.</param> public SurveyBuilderController(IUnitOfWork unitOfWork, IFileDownloader fileDownloaderService, IAuthorizationService authorizationService, IAccountManager accountManager, IQuestionTypeManager questionTypeManager, ISurveyBuilderService surveyBuilderService, IOptions <RequestLocalizationOptions> localizationOptions) { this._unitOfWork = unitOfWork; this._authorizationService = authorizationService; this._accountManager = accountManager; this._questionTypeManager = questionTypeManager; this._surveyBuilderService = surveyBuilderService; this._fileDownloader = fileDownloaderService; this._localizationOptions = localizationOptions; }
/// <summary> /// /// </summary> /// <param name="viewService"></param> /// <param name="accountManager"></param> /// <param name="unitOfWork"></param> /// <param name="builderService"></param> /// <param name="manager"></param> /// <param name="userManager"></param> /// <param name="configuration"></param> public SurveyViewerController(ISurveyViewerService viewService, IAccountManager accountManager, IUnitOfWork unitOfWork, ISurveyBuilderService builderService, IQuestionTypeManager manager, UserManager <ApplicationUser> userManager, IConfiguration configuration, IHttpContextAccessor accessor ) { this._unitOfWork = unitOfWork; this._viewService = viewService; this._accountManager = accountManager; this._builderService = builderService; this._manager = manager; this._userManager = userManager; this._configuration = configuration; this._contextAccessor = accessor; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory, IQuestionTypeManager questionTypeManager) { // loggerFactory.AddConsole(Configuration.GetSection("Logging")); // loggerFactory.AddDebug(LogLevel.Debug); loggerFactory.AddFile(Configuration.GetSection("Logging")); Utilities.ConfigureLogger(loggerFactory); EmailTemplates.Initialize(env, Configuration); questionTypeManager.LoadQuestionExtensions(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // Enforce https during production // var rewriteOptions = new RewriteOptions () // .AddRedirectToHttps (); // app.UseRewriter (rewriteOptions); app.UseExceptionHandler("/Home/Error"); } app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); //Configure Cors app.UseCors("CorsPolicy"); app.UseWebSockets(); app.UseAuthentication(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); //app.UseSignalR (routes => { routes.MapHub<NotifyHub> ("/notify"); }); app.UseEndpoints(routes => { routes.MapHub <NotifyHub> ("/notify"); }); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseHangfireServer(); app.UseHangfireDashboard(); app.UseRequestLocalization(); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "TRAISI API V1"); }); app.UseMvc(routes => { routes.MapRoute( "default", "{controller}/{action=Index}/{id?}"); }); app.MapWhen(p => !p.Request.Path.StartsWithSegments("/survey"), adminApp => { adminApp.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp/"; spa.Options.StartupTimeout = TimeSpan.FromSeconds(599); spa.Options.DefaultPage = "/admin/index.html"; if (env.IsDevelopment() || env.IsStaging()) { spa.UseAngularCliServer("start"); } }); }); app.MapWhen(p => p.Request.Path.StartsWithSegments("/survey"), surveyApp => { surveyApp.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp/"; spa.Options.DefaultPage = "/survey/index.html"; spa.Options.StartupTimeout = TimeSpan.FromSeconds(599); if (env.IsDevelopment() || env.IsStaging()) { var angularConf = Configuration["survey-start-script"] == null ? DEFAULT_SURVEY_VIEWER_SPA_START_SCRIPT : Configuration["survey-start-script"]; spa.UseAngularCliServer(angularConf); } }); }); }
/// <summary> /// Inject the QuestionTypeManager service /// </summary> /// <param name="questionTypeManager"></param> public QuestionController(IQuestionTypeManager questionTypeManager) { this._questionTypeManager = questionTypeManager; }
/// <summary> /// /// </summary> /// <param name="unitOfWork"></param> /// <param name="questions"></param> public SurveyBuilderService(IUnitOfWork unitOfWork, IQuestionTypeManager questions) { this._unitOfWork = unitOfWork; this._questions = questions; }