This commit is contained in:
2018-09-19 16:58:11 +00:00
parent 8ee3370f60
commit dbe3710e59

View File

@@ -92,24 +92,25 @@ namespace AyaNova.Biz
//Save the context in order to get the id's of the new words added
ct.SaveChanges();
====HERE
//Now add the id's of the newly created words to the matching keyword id list for this object
//OLD BORING WAY:
// foreach (SearchDictionary SD in ct.SearchDictionary.Local)
// {
// MatchingKeywordIdList.Add(SD.Id);
// }
//Linq all the things! (I'm so clever)
MatchingKeywordIdList.AddRange(ct.SearchDictionary.Local.Select(m => m.Id).ToList());
//Now add the id's of the newly created words to the matching keyword id list for this object
foreach (SearchDictionary SD in ct.SearchDictionary.Local)
{
bool IsName = false;
if (NameKeyWordList.Contains(SD.Word))
IsName = true;
MatchingKeywordIdList.Add(new MatchingDictionaryEntry() { DictionaryId = SD.Id, InName = IsName });
}
//CREATE THE SEARCHKEY RECORDS FOR ALL THE KEYWORDS
foreach (long KeyWordId in MatchingKeywordIdList)
foreach (MatchingDictionaryEntry E in MatchingKeywordIdList)
{
if ()
ct.SearchDictionary.Add(new SearchKey() { Word = KeyWord });
ct.SearchKey.Add(new SearchKey() { WordId = E.DictionaryId, InName = E.InName });
}
ct.SaveChanges();
}//eoc
//Class to hold temporary list of matching id