static IEnumerable <RoleClaim> GetPreconfiguredRoleClaims(CollegeContext collegeContext) { var result = new List <RoleClaim>(); var roles = collegeContext.Roles.ToList(); var claims = collegeContext.Claims.ToList(); var listCliamsForRoleFullAdmin = new List <string> { Constaints.ClaimAdminisiterAllUsers, Constaints.ClaimAdminisiterClaims, Constaints.ClaimAdminisiterColleges, Constaints.ClaimAdminisiterCollegeUsers, Constaints.ClaimAdminisiterHomework, Constaints.ClaimAdminisiterRoles }; var listCliamsForRoleCollegeAdmin = new List <string> { Constaints.ClaimAdminisiterCollegeUsers, Constaints.ClaimAdminisiterHomework }; var listCliamsForRoleTeacher = new List <string> { Constaints.ClaimAdminisiterHomework }; foreach (var role in roles) { if (role.RoleName == Constaints.RoleFullAdmin) { foreach (var claimName in listCliamsForRoleFullAdmin) { var roleClaim = new RoleClaim { Claim = claims.Single(o => o.ClaimName == claimName), Role = role }; result.Add(roleClaim); } } if (role.RoleName == Constaints.RoleCollegeAdmin) { foreach (var claimName in listCliamsForRoleCollegeAdmin) { var roleClaim = new RoleClaim { Claim = claims.Single(o => o.ClaimName == claimName), Role = role }; result.Add(roleClaim); } } if (role.RoleName == Constaints.RoleTeacher) { foreach (var claimName in listCliamsForRoleTeacher) { var roleClaim = new RoleClaim { Claim = claims.Single(o => o.ClaimName == claimName), Role = role }; result.Add(roleClaim); } } } return(result); }
public EfRepository(CollegeContext dbContext) { _dbContext = dbContext; }
public AppUserRepository(CollegeContext dbContext) : base(dbContext) { }