Exemple #1
0
        public ActionResult <Visita> GetVisitaById([FromHeader] string ibge, [FromRoute] int id)
        {
            try
            {
                ibge = _config.GetConnectionString(Connection.GetConnection(ibge));
                Visita        item  = _repository.GetVisitaById(ibge, id);
                List <Coleta> itens = _repository.GetColetaByVisita(ibge, id);
                if (itens.Count != 0)
                {
                    item.itens.AddRange(itens);
                }

                return(Ok(item));
            }
            catch (Exception ex)
            {
                var response = TrataErro.GetResponse(ex.Message, true);
                return(StatusCode((int)HttpStatusCode.InternalServerError, response));
            }
        }