public Response Add(ClienteDto clienteDto) { #region Validation if (clienteDto.IsNotValid()) { return(Response.BuildBadRequest(ExceptionMessages.ObjetoInvalido)); } if (!clienteDto.CpfValid()) { return(Response.BuildBadRequest(ExceptionMessages.CpfInvalido)); } if (_clienteRepository.Any(CpfValidation.Limpa(clienteDto.Cpf))) { return(Response.BuildBadRequest(ExceptionMessages.CpfJaCadastrado)); } #endregion var cliente = _clienteRepository .Add(_mapper.Map <Cliente>(clienteDto)); if (!_unitOfWork.Commit()) { throw new ExceptionHttp(ExceptionMessages.ErroAoSalvarDados); } return(Response.BuildSuccess(_mapper.Map <ClienteDto>(cliente))); }