public PendenciasCliente ObterDetalhesPagamento(long idPagamento) { var detalhesPagamento = new PendenciasCliente(); detalhesPagamento.CashGames = CashGameRepositorio.Filtrar(d => d.IdComprovantePagamento == idPagamento).ToList(); detalhesPagamento.TorneiosCliente = PagamentosAplicacao.ObterItensTorneioModel(TorneiosClienteRepositorio.Filtrar(d => d.IdComprovantePagamento == idPagamento).ToList()); var idNomeCliente = PagamentoRepositorio.Filtrar(d => d.Id == idPagamento).Select(d => new { Nome = d.Cliente.Nome, Id = d.IdCliente, Saldo = d.Cliente.Saldo }).FirstOrDefault(); detalhesPagamento.IdCliente = idNomeCliente.Id; detalhesPagamento.NomeCliente = idNomeCliente.Nome; detalhesPagamento.Saldo = idNomeCliente.Saldo; var vendas = VendaRepositorio.Filtrar(d => d.IdComprovantePagamento == idPagamento).ToList(); detalhesPagamento.Vendas = new List <VendaModel>(); detalhesPagamento.Parcelamentos = ParcelamentoPagamentoRepositorio.Filtrar(d => d.IdPagamento == idPagamento).ToList(); //if (detalhesPagamento.Parcelamentos.Count() == 1) // detalhesPagamento.Parcelamentos = new List<ParcelamentoPagamento>(); foreach (var venda in vendas) { detalhesPagamento.Vendas.Add(new VendaModel(venda, PreVendaRepositorio)); } return(detalhesPagamento); }