private void GetInvestments(AllInvestment allInvestment, InvestmentResponse result) { foreach (var tesouroDireto in allInvestment.TesouroDiretoResponse.TesourosDireto) { var investment = new Responses.Investment(); CalculationTesouro(investment, tesouroDireto); _investments.Add(investment); } foreach (var fundos in allInvestment.FundosResponse.Fundos) { var investment = new Responses.Investment(); CalculationFundos(investment, fundos); _investments.Add(investment); } foreach (var rendaFixa in allInvestment.LciResponse.Lcis) { var investment = new Responses.Investment(); CalculationRendaFixa(investment, rendaFixa); _investments.Add(investment); } result.Investimentos = _investments; }
public InvestmentResponse ExecuteAllInvestment(AllInvestment allInvestment) { var result = new InvestmentResponse(); GetTotalInvestment(allInvestment, result); GetInvestments(allInvestment, result); return(result); }
private static void GetTotalInvestment(AllInvestment allInvestment, InvestmentResponse result) { var rendaFixaValorInvestido = allInvestment.LciResponse.Lcis.Select(v => v.CapitalInvestido).Sum(); var tesouroValorInvestido = allInvestment.TesouroDiretoResponse.TesourosDireto.Select(t => t.ValorInvestido).Sum(); var fundosValorInvestido = allInvestment.FundosResponse.Fundos.Select(f => f.CapitalInvestido).Sum(); result.ValorTotal = rendaFixaValorInvestido + tesouroValorInvestido + fundosValorInvestido; }