public static void Collect(int issueId, string text, int count, int wordsInText) { if (_cache == null) _cache = new List<Model.Word>(); var wordItem = new Model.Word() { IssueId = issueId, Text = text, Count = count, WordsInText = wordsInText, Created = DateTime.Now }; var _cacheItem = _cache.FirstOrDefault(i => i.IssueId == wordItem.IssueId && i.Text == wordItem.Text); if (_cacheItem != null) _cacheItem.Count += count; else _cache.Add(wordItem); }
public static void Collect(int issueId, string text, int count, int wordsInText) { if (_cache == null) { _cache = new List <Model.Word>(); } var wordItem = new Model.Word() { IssueId = issueId, Text = text, Count = count, WordsInText = wordsInText, Created = DateTime.Now }; var _cacheItem = _cache.FirstOrDefault(i => i.IssueId == wordItem.IssueId && i.Text == wordItem.Text); if (_cacheItem != null) { _cacheItem.Count += count; } else { _cache.Add(wordItem); } }