public IEnumerable <ConcreteEmailMessage> GetAll() { foreach (var key in _statuses.Keys.ToList()) { var result = new ConcreteEmailMessage() { EmailId = key, EmailMessage = _mails[key] }; yield return(result); } }
public IEnumerable <ConcreteEmailMessage> GetPendingMails() { var pendingIds = _statuses .Where(x => x.Value == EmailSendingStatus.Pending) .Select(x => x.Key) .ToList(); foreach (var pendingId in pendingIds) { var result = new ConcreteEmailMessage() { EmailId = pendingId, EmailMessage = _mails[pendingId] }; yield return(result); } }