public ActionResult GetFotoByCidadao([FromHeader] string ibge, [FromRoute] int id) { try { ibge = _config.GetConnectionString(Connection.GetConnectionFoto(ibge)); var foto = _cidadaoRepository.GetFotoByCidadao(ibge, id); var fotobase = new { fotobase64 = foto != null?Convert.ToBase64String(foto) : string.Empty }; return(Ok(fotobase)); } catch (Exception ex) { var response = TrataErro.GetResponse(ex.Message, true); return(StatusCode((int)HttpStatusCode.InternalServerError, response)); } }