Ejemplo n.º 1
0
        public async Task <IEnumerable <DeliveryModel> > GetDeliveriesForEvent(string eventId, bool forceRefresh = false)
        {
            IEnumerable <DeliveryModel> deliveries = null;

            if (!_dictDeliveries.ContainsKey(eventId) || !_config.UseCache || (_config.UseCache && forceRefresh))
            {
                deliveries = await _repoDeliveries.GetItemsAsyncOrderByDescending(p => p.EventId == eventId,
                                                                                  p => p.Date);

                if (deliveries == null)
                {
                    _logger.LogDebug($"GetDeliveriesForEvent: No deliveries found for event {eventId}.");
                }
                _dictDeliveries[eventId] = deliveries;
            }
            else
            {
                deliveries = _dictDeliveries[eventId];
            }
            return(deliveries);
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <NoteModel> > GetNotesFromEvent(string eventId, bool forceRefresh = false)
        {
            IEnumerable <NoteModel> notes = null;

            if (!_dictEvents.ContainsKey(eventId) || !_config.UseCache || (_config.UseCache && forceRefresh))
            {
                notes = await _repoNotes.GetItemsAsyncOrderByDescending(p => p.EventId == eventId, p => p.Date, _config.MaxNoteItems);

                if (notes == null)
                {
                    _logger.LogDebug($"GetNotesFromEvent: No notes found for event {eventId}.");
                }
                _dictEvents[eventId] = notes;
            }
            else
            {
                notes = _dictEvents[eventId];
            }
            return(notes);
        }