Beispiel #1
0
        public Result <string, IList <Transaction> > GetTransactions(long accountId, DateTime start, DateTime end)
        {
            try
            {
                if (!AccountExists(accountId))
                {
                    _logger.LogError("account with id: {0} doesn't exists", accountId);
                    return(Result <string, IList <Transaction> > .ForFailure("Account doesn't exists"));
                }

                _logger.LogInformation("getting transactions from: {0} to: {1}, accountId: {3}", start, end, accountId);
                var transactions = _transactionDao.GetTransactions(accountId, start, end);

                return(Result <string, IList <Transaction> > .ForSuccess(transactions));
            }
            catch (Exception ex)
            {
                _logger.LogError("Can't get transactions: {0}", ex.StackTrace);
                return(Result <string, IList <Transaction> > .ForFailure("Can't get transactions"));
            }
        }