示例#1
0
        //find word anagrams
        public async Task <ViewResult> Anagram(String word)
        {
            string ip = LogActivities.GetIPAddress();

            if (UsersLogService.IsPermittedToView(ip))
            {
                //cookies - last searched words
                WebCookies.AddNewWordToHistory(Request, Response, word);
                //find anagrams -- find if there are cached words
                //List<string> anagrams = CachedWordService.FindAnagrams(word);
                List <string> anagrams = await Task.Run(() => (CachedWordService.FindAnagrams(word)));

                ViewBag.Anagrams = anagrams;
                //UserLog
                Task.Run(() => LogActivities.LogWordViewed(word));
            }
            else
            {
                ViewBag.Permitted = false;
            }
            return(View("Index"));
        }