예제 #1
0
        public void Delete(string word)
        {
            var wordToDelete = context.Words.FirstOrDefault(w => w.Word == word);

            context.Words.Remove(wordToDelete);
            context.SaveChanges();
        }
예제 #2
0
        public void SaveNewUser(string userIp, int amount)
        {
            NumOfAllowedSearchesEntity allowedSearches = new NumOfAllowedSearchesEntity();

            allowedSearches.UserIp = userIp;
            allowedSearches.Amount = amount;

            context.NumOfAllowedSearches.Add(allowedSearches);
            context.SaveChanges();
        }
예제 #3
0
        public void Save(string ip, string word, DateTime time)
        {
            UserLogEntity log = new UserLogEntity();

            log.UserIp     = ip;
            log.Word       = word;
            log.SearchTime = time;

            context.UserLog.Add(log);
            context.SaveChanges();
        }
예제 #4
0
        public void Save(string word, IEnumerable <string> anagrams)
        {
            var wordId = context.Words.Where(w => anagrams.Contains(w.Word)).Select(i => i.Id);

            foreach (var id in wordId)
            {
                CachedWordsEntity cache = new CachedWordsEntity();
                cache.Word      = word;
                cache.AnagramId = id;
                context.CachedWords.Add(cache);
            }
            context.SaveChanges();
        }