Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!