private async Task SeedAdminUser(OmmDbContext context, UserManager <Employee> userManager) { if (!context.Users.Any(u => u.UserName == AdminUsername)) { Employee admin = new Employee() { UserName = AdminUsername, Email = AdminEmail, FirstName = AdminFirstName, LastName = AdminLastName, FullName = AdminFullName, AccessLevel = AdminAccessLevel, IsActive = true, ProfilePicture = AdminPicture }; var result = userManager.CreateAsync(admin, AdminPassword).GetAwaiter().GetResult(); if (result.Succeeded) { await userManager.AddToRoleAsync(admin, AdminRole); await userManager.AddClaimAsync(admin, new Claim(InfrastructureConstants.ACCESS_LEVEL_CLAIM, admin.AccessLevel.ToString())); } } }
public EmployeesService(UserManager <Employee> userManger, SignInManager <Employee> signInManager, OmmDbContext context, IDepartmentsService departmentsService, ISendGrid emailSender) { this.userManger = userManger; this.signInManager = signInManager; this.context = context; this.departmentsService = departmentsService; this.emailSender = emailSender; }
private async Task SeedData(OmmDbContext context) { await context.AddRangeAsync(GetEmployeesDummyData()); await context.AddRangeAsync(GetAssignmentsDummyData()); await context.SaveChangesAsync(); await context.AddRangeAsync(GetAssignmentsEmployeesDummyData()); await context.SaveChangesAsync(); }
public ProjectsService(OmmDbContext context, IReportsService reportsService, IStatusesService statusesService, IEmployeesService employeesService, IProjectPositionsService projectPositionsService, IEmployeesProjectsPositionsService employeesProjectsPositionsService, IAssignmentsService assignmentsService) { this.context = context; this.reportsService = reportsService; this.statusesService = statusesService; this.employeesService = employeesService; this.projectPositionsService = projectPositionsService; this.employeesProjectsPositionsService = employeesProjectsPositionsService; this.assignmentsService = assignmentsService; }
private async Task SeedData(OmmDbContext context) { await context.AddRangeAsync(GetEmployeeDummyData()); await context.AddRangeAsync(GetProjectDummyData()); await context.AddRangeAsync(GetProjectPositionDummyData()); await context.SaveChangesAsync(); await context.AddRangeAsync(GetEmployeeProjectsPositionsDummyData()); await context.SaveChangesAsync(); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { this.context = (OmmDbContext)validationContext.GetService(typeof(OmmDbContext)); var propertyValues = this.context.Users.Select(u => u.GetType() .GetProperty(this.property, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase) .GetValue(u, null)) .Select(v => v.ToString()) .ToList(); if (propertyValues.Any(v => v == (string)value)) { return(new ValidationResult(this.ErrorMessage)); } return(ValidationResult.Success); }
public ActivitiesService(OmmDbContext context) { this.context = context; }
public DepartmentsService(OmmDbContext context) { this.context = context; }
public ProjectPositionSeeder(OmmDbContext context) { this.context = context; }
public ReportsService(OmmDbContext context) { this.context = context; }
public EmployeesProjectsPositionsService(OmmDbContext context) { this.context = context; }
public AssignmentsEmployeesService(OmmDbContext context) { this.context = context; }
public ProjectPositionsService(OmmDbContext context) { this.context = context; }
public AssetTypeSeeder(OmmDbContext context) { this.context = context; }
public RolesSeeder(OmmDbContext context) { this.context = context; }
public LeavingReasonsService(OmmDbContext context) { this.context = context; }
public StatusSeeder(OmmDbContext context) { this.context = context; }
private async Task SeedData(OmmDbContext context) { await context.AddRangeAsync(GetDummyData()); await context.SaveChangesAsync(); }
public LeavingReasonSeeder(OmmDbContext context) { this.context = context; }
public StatusesService(OmmDbContext context) { this.context = context; }
public CustomExceptionFilterAttribute(OmmDbContext context) { this.dbContext = context; }
public AssetTypesService(OmmDbContext context) { this.context = context; }
public AssignmentsService(OmmDbContext context, IStatusesService statusesService, IAssignmentsEmployeesService assignmentsEmployeesService) { this.context = context; this.statusesService = statusesService; this.assignmentsEmployeesService = assignmentsEmployeesService; }
public DepartmentSeeder(OmmDbContext context) { this.context = context; }