public UserController(BrainStormDbContext context, IUnitService unitService,
                       UserManager <BrainStormUser> userManager)
 {
     _context     = context;
     _unitService = unitService;
     _userManager = userManager;
 }
Beispiel #2
0
 public TutorialsController(BrainStormDbContext context, IUnitService unitService)
 {
     _context     = context;
     _unitService = unitService;
 }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env,
                              BrainStormDbContext context,
                              RoleManager <BrainStormRole> roleManager,
                              UserManager <BrainStormUser> userManager)
        {
            if (env.IsDevelopment())
            {
                app.UseHealthChecks("/health");

                // When the app runs in the Development environment:
                //   Use the Developer Exception Page to report app runtime errors.
                //   Use the Database Error Page to report database runtime errors.
                app.UseDeveloperExceptionPage();
                // app.UseDatabaseErrorPage();
            }
            else
            {
                // When the app doesn't run in the Development environment:
                //   Enable the Exception Handler Middleware to catch exceptions
                //     thrown in the following middlewares.
                //   Use the HTTP Strict Transport Security Protocol (HSTS)
                //     Middleware.
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            // Use HTTPS Redirection Middleware to redirect HTTP requests to HTTPS.
            app.UseHttpsRedirection();
            // Return static files and end the pipeline.
            app.UseStaticFiles();
            // Use Cookie Policy Middleware to conform to EU General Data
            // Protection Regulation (GDPR) regulations.
            app.UseCookiePolicy();

            app.UseRouting();
            // Authenticate before the user accesses secure resources.
            app.UseAuthentication();
            app.UseAuthorization();


            app.UseEndpoints(endpoints =>
            {
                endpoints.MapHub <ChatHub>("/chat");

                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });

            app.UseSpaStaticFiles();

            app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());

            // Add MVC to the request pipeline.

            DBInitializer.InitializeAsync(app, context, userManager, roleManager).Wait();

            app.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";

                if (env.IsDevelopment())
                {
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });
        }
 public CategoriesController(BrainStormDbContext context, IUnitService unitService)
 {
     _context     = context;
     _unitService = unitService;
 }
 public CommentsController(BrainStormDbContext context, IUnitService unitService)
 {
     _context     = context;
     _unitService = unitService;
 }
 public ArticleService(BrainStormDbContext context) : base(context)
 {
 }
Beispiel #7
0
 public CategoryService(BrainStormDbContext context) : base(context)
 {
 }
 public CommentService(BrainStormDbContext context) : base(context)
 {
 }
Beispiel #9
0
 public ArticlesController(BrainStormDbContext context, IUnitService unitService)
 {
     _context     = context;
     _unitService = unitService;
 }
Beispiel #10
0
 public UnitService(BrainStormDbContext context)
 {
     _context = context ?? throw new ArgumentException("db context can not be null");
 }
Beispiel #11
0
 public UserService(BrainStormDbContext context)
 {
     this._context = context;
 }
Beispiel #12
0
 public ImageHelper(BrainStormDbContext context)
 {
     this._context = context;
 }