// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              RoleManager <IdentityRole> roleManager, UserManager <ApplicationUser> userManager,
                              IDocumentTypeRepository typeRepository, IAccessTypeRepository accessType,
                              IApprovalStatusRepository approvalStatus, IApprovalProgressStatusRepository approvalProgress,
                              IAuditActionRepository actionRepository)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            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();
            }
            SeedData.SeedDatas(roleManager, userManager, typeRepository, accessType, approvalProgress, approvalStatus, actionRepository);
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseAuthentication();
            app.UseCookiePolicy();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
 public static void SeedDatas(
     RoleManager <IdentityRole> roleManager, UserManager <ApplicationUser> userManager,
     IDocumentTypeRepository typeRepository, IAccessTypeRepository accessType,
     IApprovalProgressStatusRepository approvalProgress, IApprovalStatusRepository approvalStatus,
     IAuditActionRepository actionRepository
     )
 {
     SeedRoles(roleManager);
     SeedUsers(userManager);
     SeedDocumentType(typeRepository);
     SeedAccessType(accessType);
     SeedApprovalProgressStatus(approvalProgress);
     SeedApprovalStatus(approvalStatus);
     SeedAuditAction(actionRepository);
 }
 public static void SeedAuditAction(IAuditActionRepository actionRepository)
 {
     string[] auditActionList = new string[] { "Add", "Delete", "Disable", "Edit", "Enable",
                                               "Login", "Password Reset", "Upload", "Download", "User Creation" };
     foreach (string action in auditActionList)
     {
         if (actionRepository.FindByNameAsync(action).Result == null)
         {
             AuditAction auditAction = new AuditAction()
             {
                 ActionName = action
             };
             try
             {
                 actionRepository.SaveActionAsync(auditAction);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex);
             }
         }
     }
 }