예제 #1
0
        public async Task <Dictionary <string, List <string> > > SearchPNLAsync(String query = "")
        {
            var pasList = await MdApi.GetDictionaryAsync();

            if (String.IsNullOrEmpty(query) || query.Length <= 2)
            {
                return(pasList);
            }

            var matchedKeys = pasList.Where(x => WildCardMatch(query.ToLowerInvariant(), x.Key.ToLowerInvariant()));

            var MatchedRecords = new Dictionary <String, List <String> >();

            foreach (var r in pasList)
            {
                var matched = r.Value.Where(x => WildCardMatch(query.ToLowerInvariant(), x.ToLowerInvariant()));
                if (matched.Count() > 0)
                {
                    MatchedRecords.TryAdd(r.Key, matched.ToList());
                }
            }
            return(MatchedRecords.MergeLeft(matchedKeys.ToDictionary(x => x.Key, x => x.Value)));
        }
예제 #2
0
 public async Task <IActionResult> Index()
 {
     return(View(await MdApi.GetDictionaryAsync()));
 }