public async Task <IActionResult> Exist(string name, int?id = null) { try { var ext = await _empresaService.Exists(name, id); return(Ok(new { valid = !ext })); } catch (Exception e) { return(StatusCode(500, e.Message)); } }