public async Task <ActionResult <Proposal> > GetProposal(string idProposal)
        {
            try
            {
                var plansDto = await _suggestorLogic.GetActualPlans();

                var mobileListDto = await _suggestorLogic.GetEquiposPymes();

                var ProposalDto = await _ProposalLogic.GetProposal(idProposal);

                var proposalLinesDTO = await _ProposalLogic.GetLineasProposal(ProposalDto.Id);

                var mobileDevicesDTO = await _ProposalLogic.GetEquiposProposal(ProposalDto.Id);

                var clientList = _clientLogic.GetClientes().Result;

                var proposal = _mapper.Map <Proposal>(ProposalDto);
                PopulateProposalLines(proposal, plansDto, proposalLinesDTO);
                PopulateProposalMobileList(proposal, mobileListDto, mobileDevicesDTO);
                PopulateClientName(proposal, clientList);

                return(proposal);
            }
            catch (Exception ex)
            {
                var extraData = new { propuestaId = idProposal };
                _logLogic.InsertLog(new Log("/api/getProposal", ex.Message, extraData));
                throw ex;
            }
        }
Beispiel #2
0
        public async Task <ActionResult <List <SuggestorClient> > > GetClients()
        {
            try
            {
                var clientList = new List <SuggestorClient>();
                var clientsDto = await _clientService.GetClientes();

                foreach (var item in clientsDto)
                {
                    var clientModel = _mapper.Map <SuggestorClient>(item);
                    clientList.Add(clientModel);
                }

                return(clientList);
            }
            catch (Exception ex)
            {
                _logLogic.InsertLog(new Log("/api/getClients", ex.Message));
                throw ex;
            }
        }