Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

why id=0 when make it integer but if string it get value ?

$
0
0

I work on asp.net core 2.2 really when assign value to id on url as id=5

it display on debugging id=0 although i write value beside id 

i write my URL as below 

 [HttpGet]
        [Route("GetAllFilters/{id}")]
        public IActionResult GetAllFilters(int id)
        {

            try
            {
                //string[] s = id.Split('=');
               
               // int Reportid = Convert.ToInt32(s[1]);
                var getfilters = _reportservice.GetReportFilter(id);
               
                return Ok(getfilters);
            }
            catch (Exception ex)
            {

                return NotFound(ex.Message);
            }

        }

I write on my URL as below 

http://localhost:61265/api/GetAllFilters/report/id=5

so why id=0 this is my question and how to solve that

i send get request from google chrome browser  visual studio 2017


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>