public void Delete(string word) { var wordToDelete = context.Words.FirstOrDefault(w => w.Word == word); context.Words.Remove(wordToDelete); context.SaveChanges(); }
public void SaveNewUser(string userIp, int amount) { NumOfAllowedSearchesEntity allowedSearches = new NumOfAllowedSearchesEntity(); allowedSearches.UserIp = userIp; allowedSearches.Amount = amount; context.NumOfAllowedSearches.Add(allowedSearches); context.SaveChanges(); }
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(); }
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(); }