Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
Can we pass a IHttpActionResult without passing a parameter

I am new to web api and react. I was trying to pass a method IHttpActionResult in the following way in visual studio

namespace specialRequest.Controllers
{
    [RoutePrefix("api/observation")]
    public class T_SVRS_FormController : ApiController
    {
        [HttpPost]
        [Route("GetLocations")]
        public IHttpActionResult GetLocations(string jwt)
        {
            OracleConnection connOra = new OracleConnection(Utilities.LGS_DB);

            try
            {
                
                DataTable oraDataTable = new DataTable();

                

                string query = "select RDN_DESTN_DESC  from strdba.t_rail_destn";
                OracleCommand oraCmd = new OracleCommand(query, connOra);
                connOra.Open();


                // create data adapter
                OracleDataAdapter oraDA = new OracleDataAdapter(oraCmd);
                // this will query your database and return the result to your datatable
                oraDA.Fill(oraDataTable);

                return Ok(oraDataTable);

            }
            catch (Exception ex)
            {
                // conn1.Close();
                
                connOra.Close();
                return Content(HttpStatusCode.NoContent, "Something went wrong");
            }
        }

    }
}

I dont need the parameter jwt can I pass IHttpActionResult without a parameter. When I try to remove the parameter the editor shows error saying atleast 1 accssesor is required.

Also since there is a parameter my dropdown is not picking up this value of the following code in react

getLocations = () => {
    var Items = [];
    axios.post('api/observation/GetLocations').then(response => {
      response.data.map(item => {
        var obj = new Object();
        Items.push(obj);
      });
      this.setState({ locations: Items });
    });
    console.log('Response:' + this.state.locations);
  };

How do I pass IHttpActionResult without a parameter so that my code in react works. Please help and please understand that I am new to this and in a pickle any help will be appreciated

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda