public int Salvar(Cliente cliente)
{
try
{
InstanciarClienteBO();
int retorno = Insucesso;
if (_clienteBO.VerificarSeJaExisteNoSalvamento(cliente) == NaoExiste)
{
_banco.Entry(cliente).State = EntityState.Added;
retorno = _banco.SaveChanges() == Sucesso ? Sucesso : Insucesso.ErroCustomForTernary("Não foi possível salvar o cliente");
}
return retorno;
}
catch (CustomException erro)
{
throw new CustomException(erro.Message);
}
catch (Exception erro)
{
throw new Exception(erro.Message);
}
}