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); }
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); }
public ClienteViewModel ObterPorEmail(string email) { return(AutoMapperSingleton.GetInstance() .Map <ClienteViewModel>(_clienteRepository.ObterPorEmail(email))); }
public ClienteViewModel ObterPorCpf(string cpf) { return(AutoMapperSingleton.GetInstance() .Map <ClienteViewModel>(_clienteRepository.ObterPorCpf(cpf))); }
public IEnumerable <ClienteViewModel> ObterAtivos() { return(AutoMapperSingleton.GetInstance() .Map <IEnumerable <ClienteViewModel> >(_clienteRepository.ObterAtivos())); }
public ClienteViewModel ObterPorId(Guid id) { return(AutoMapperSingleton.GetInstance() .Map <ClienteViewModel>(_clienteRepository.ObterPorId(id))); }