예제 #1
0
        public ClienteViewModel Atualizar(ClienteViewModel clienteViewModel)
        {
            var cliente = AutoMapperSingleton.GetInstance().Map <Cliente>(clienteViewModel);

            var clienteReturn = _clienteService.Atualizar(cliente);

            if (clienteReturn.ValidationResult.IsValid)
            {
                Commit();
            }

            clienteViewModel = AutoMapperSingleton.GetInstance().Map <ClienteViewModel>(clienteReturn);

            return(clienteViewModel);
        }
예제 #2
0
        public ClienteEnderecoViewModel Adicionar(ClienteEnderecoViewModel clienteEnderecoViewModel)
        {
            var cliente  = AutoMapperSingleton.GetInstance().Map <Cliente>(clienteEnderecoViewModel.Cliente);
            var endereco = AutoMapperSingleton.GetInstance().Map <Endereco>(clienteEnderecoViewModel.Endereco);

            cliente.Enderecos.Add(endereco);
            var clienteReturn = _clienteService.Adicionar(cliente);

            if (clienteReturn.ValidationResult.IsValid)
            {
                Commit();
            }

            clienteEnderecoViewModel.Cliente = AutoMapperSingleton.GetInstance().Map <ClienteViewModel>(clienteReturn);
            return(clienteEnderecoViewModel);
        }
예제 #3
0
 public ClienteViewModel ObterPorEmail(string email)
 {
     return(AutoMapperSingleton.GetInstance()
            .Map <ClienteViewModel>(_clienteRepository.ObterPorEmail(email)));
 }
예제 #4
0
 public ClienteViewModel ObterPorCpf(string cpf)
 {
     return(AutoMapperSingleton.GetInstance()
            .Map <ClienteViewModel>(_clienteRepository.ObterPorCpf(cpf)));
 }
예제 #5
0
 public IEnumerable <ClienteViewModel> ObterAtivos()
 {
     return(AutoMapperSingleton.GetInstance()
            .Map <IEnumerable <ClienteViewModel> >(_clienteRepository.ObterAtivos()));
 }
예제 #6
0
 public ClienteViewModel ObterPorId(Guid id)
 {
     return(AutoMapperSingleton.GetInstance()
            .Map <ClienteViewModel>(_clienteRepository.ObterPorId(id)));
 }