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); } }
public bool UserExists(string login) { return(citizenUserRepository.UserExists(login)); }