//// version générique à revoir à cause de item.name //internal static bool CheckIfUniversal<T>(IList<T> lisT) //{ // bool result = true; // List<string> titleList = new List<string>(); // foreach (var item in lisT) // { // if (item.name != null) // { // titleList.Add(item.name); // } // } // if (titleList.Count() > 1) // { // result = false; // } // return result; //} #region CheckIfNameExist internal static bool CheckIfNameExist(IList <HERO_TRANSLATION> heroesT) { using (IDalHero dal = new DalHero()) { bool result = false; List <string> nameList = dal.GetAllHeroTrans().Select(n => n.nameHero.ToLower()).ToList(); foreach (var item in heroesT) { if (item.nameHero != null) { if (nameList.Contains(item.nameHero.ToLower())) { result = true; break; } } } return(result); } }
public HeroesController(DalHero context) { _dalHero = context; }