예제 #1
0
        private void AddIfNotExistUsersWithRole(List <CitizenUser> users, string roleName = null)
        {
            foreach (var user in users.Where(u => !citizenUserRepository.UserExists(u.Login)))
            {
                if (roleName != null)
                {
                    var role = roleRepository.GetRoleByName(roleName);
                    user.Roles.Add(role);
                }

                citizenUserRepository.Save(user);
            }
        }
예제 #2
0
 public bool UserExists(string login)
 {
     return(citizenUserRepository.UserExists(login));
 }