public List <AccountHistoryEntity> GetAll()
        {
            if (cache == null || cache.Count == 0)
            {
                var entities = repository.GetAll();
                cache = new ConcurrentDictionary <Guid, AccountHistoryEntity>(entities.ToDictionary(e => e.TransitionId));
            }

            return(cache.Select(x => x.Value).ToList());
        }
예제 #2
0
        public Task <IEnumerable <TransactionHistoryQueryResult> > Handle(TransactionHistoryQuery request, CancellationToken cancellationToken)
        {
            Auth.Instance.LoggedInUserId.MustNotBeDefault(ex: new UserNotLoggedInException(ExceptionMessage.UserNotLoggedInExceptionMessage));

            IEnumerable <AccountHistory> accountHistory = _accountHistoryRepository.GetAll(x => x.UserId == Auth.Instance.LoggedInUserId);

            IEnumerable <TransactionHistoryQueryResult> result = accountHistory.Select(x => new TransactionHistoryQueryResult
            {
                DateCreated = x.DateCreated.ToString("f"),
                Message     = x.Message
            });

            return(Task.FromResult(result));
        }