private void CheckListIfExist(SpecilizationModel item) { //Perform a check here if (!ListSpecilizations.Exists(x => x.Title == item.Title)) { //add all matches to Mainlist ListSpecilizations.Add(item); } }
private List <SpecilizationModel> SearchListForMatch(char[] word) { TempList = ListSpecilizations; ListSpecilizations.Clear(); if (word != null) { foreach (var item in TempList) { } return(null); } else { //Return the full list return(ListSpecilizations = TempList); } }
//will go to the event handler private List <SpecilizationModel> Search(string queryText) { string capdQueryText = queryText.Substring(0, 1).ToUpper() + queryText.Substring(1, queryText.Length - 1); //Run Procedural method Procedural(); var arrayOfQueryString = capdQueryText.ToArray(); //Add each letter of the string to the declared char array for (int i = 0; i < capdQueryText.Length; i++) { int j = 0; //charcterContainer must compare the Title string in listSpec //Returns A twice when i enter a second char foreach (var item in TempList) { if (item.Title[j] == arrayOfQueryString[i]) { //Perform a check if object exists in the list & Edit the list CheckListIfExist(item); //Usecase: string 1 = dentist & string 2 = diet if (item.Title[j] != arrayOfQueryString[i]) { ListSpecilizations.Remove(item); } } } j++; } return(ListSpecilizations); }