public DatePage GetDatePage(ref string date) { if (date.IsNullOrEmpty()) { return(new DatePage()); } if (_currentDate != DateTime.Today) { _currentDate = DateTime.Today; lock (_timeList) { using (GushDBContext db = new GushDBContext()) { _timeList = db.AlarmNotesList.OrderBy(d => d.Date).ToList().ConvertAll(d => d.Date).Distinct() .ToList(); } } } if (_timeList.IsNullOrEmpty()) { return(new DatePage()); } if (!_timeList.Contains(date)) { date = _timeList.LastOrDefault(); } return(_getDatePage(date)); }