public bool CNPJJaCadastrado(string cnpj, int id) { if (id > 0) { return(_service.GetAll().Any(c => c.CNPJ == cnpj && c.PessoaId != id)); } else { return(_service.GetAll().Any(c => c.CNPJ == cnpj)); } }
public async Task <IActionResult> GetAll() { try { var result = await _pessoaJuridicaService.GetAll(); if (result != null) { return(new OkObjectResult(result)); } return(NotFound()); } catch (Exception ex) { throw new Exception(ex.Message); } }