public TrendingEvent(string date, string name) { this.Date = date; this.Name = name; var cache = new Managers.CacheManager(_key); var match = false; _trendingEvents = (List <TrendingEvent>)cache.GetFromCache(); foreach (var trendingEvent in _trendingEvents) { if (date == this.Date && name == this.Name) { _trendingEvents.Remove(trendingEvent); trendingEvent.Count++; _trendingEvents.Add(trendingEvent); cache.RemoveFromCache(); cache.SaveToCache(_trendingEvents); match = true; break; } } if (match == false) { _trendingEvents.Add(this); cache.SaveToCache(_trendingEvents); } }
public TrendingEvent() { var cache = new Managers.CacheManager(_key); _trendingEvents = (List <TrendingEvent>)cache.GetFromCache(); }