Ejemplo n.º 1
0
        public ActionResult PegarFormaDePagamento(Guid IdCliente)
        {
            var cliente = clienteRepository.ObterPorId(IdCliente);

            IList <FormaDePagamento> formasPagamentos = new List <FormaDePagamento>();

            if (cliente.TipoDoCliente == TipoCliente.Vip)
            {
                formasPagamentos = formaPagamentoRepository.ObterListarFormaPagamentoVip();
            }
            else
            {
                formasPagamentos = formaPagamentoRepository.ObterFormaPagamentoComum();
            }

            return(PartialView("_ParcialViewFormaDePagamento", formasPagamentos));
        }
        public JsonResult ObterInformacoesBasicasCliente(Guid idCliente)
        {
            var vendaViewModel = new CadastrarVendaViewModel();

            vendaViewModel.Performance = Mapper.Map <IList <Performance> >(_perfomanceRepository.ObterPorIdCliente(idCliente));

            var cliente = Mapper.Map <Cliente>(_clienteRepository.ObterPorId(idCliente));

            if (cliente.Tipo.ToString() == TipoCliente.Vip.ToString())
            {
                vendaViewModel.FormasDePagamentos = Mapper.Map <IList <FormaDePagamento> >(_formaPagamentoRepository.ObterListarFormaPagamentoVip());
            }
            else
            {
                vendaViewModel.FormasDePagamentos = Mapper.Map <IList <FormaDePagamento> >(_formaPagamentoRepository.ObterFormaPagamentoComum());
            }

            if (cliente.Endereco == null)
            {
                cliente.Endereco = new Endereco();
            }

            return(Json(new { formasDePagamento = vendaViewModel.FormasDePagamentos, customs = vendaViewModel.Performance, endereco = cliente.Endereco }));
        }