public static bool IsLoginLibre(string value) { List <string> _listeLogin = new List <string>(); ClientDalService clientApi = new ClientDalService(); _listeLogin = clientApi.GetAll().Select(p => p.clientLogin).ToList(); bool test = true; if (value != null) { string login = value.ToString(); if (_listeLogin.Count() > 0) { for (int i = 0; i < _listeLogin.Count(); i++) { if (_listeLogin[i].ToLower() == login.ToLower()) { test = false; i = _listeLogin.Count() + 1; } } } else { test = true; } } else { test = false; } return(test); }