public IEnumerable <Debt> GetDebts(decimal?originalValue, DateTime?originalDate, long?FKInterestType, int?installments, DateTime?finalDate, int?comission) { IEnumerable <Debt> response = _iMapper.Map <List <Debt> >(_debtService.GetDebts(originalValue, originalDate, FKInterestType, installments, finalDate, comission).ToList()); return(response); }
public IActionResult Get() { try { var debts = _debtService.GetDebts(); return(Ok(debts)); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }
// GET api/debts public async Task <IEnumerable <Debt> > Get(string id) { var sessionModel = await _repository.GetSession(id); var actionModels = await _repository.GetSessionActions(id); var actions = _actionsProvider.GetSessionActions(sessionModel, actionModels); return(_debtService.GetDebts(actions).Select(d => new Debt { Debtor = d.Debtor, Creditor = d.Creditor, Transactions = d.Transactions.OrderByDescending(t => t.Date).ToList() }) .OrderBy(d => d.Debtor) .ThenBy(d => d.Creditor)); }