public HomeController(ILogger <HomeController> logger, SubmissionContext context, PayPeriodContext pcontext, UserManager <AdminUIUser> userManager)
 {
     _logger      = logger;
     _context     = context;
     _pcontext    = pcontext;
     _userManager = userManager;
 }
Exemplo n.º 2
0
        public PayPeriodContext GetPayPeriodContext()
        {
            var options = new DbContextOptionsBuilder <PayPeriodContext>()
                          .UseInMemoryDatabase(databaseName: "InMemoryArticleDatabase")
                          .Options;
            var dbContext = new PayPeriodContext(options);

            return(dbContext);
        }
 public PayPeriodController(PayPeriodContext context)
 {
     _context = context;
 }
Exemplo n.º 4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, RoleManager <IdentityRole> roleManager, PayPeriodContext ppcontext, SubmissionContext scontext)
        {
            GlobalVariables.CurrentPayPeriod = ppcontext.PayPeriods.FirstOrDefault(p => p.Current);
            SeedRoles(roleManager);

            if (env.IsDevelopment())
            {
                MockData.InitializeSubmissionDb(scontext);
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                // Homescreen route
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });
        }
 public HomeControllerTests()
 {
     _logger   = new NullLogger <HomeController>();
     _scontext = new InMemoryDbContextFactory().GetSubmissionContext();
     _pcontext = new InMemoryDbContextFactory().GetPayPeriodContext();
 }