Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

139
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda