Hello,
The id is always coming null because you may not be using properly to assign the id.
First of all the parameter you have written is
int? x
The default behaviour of MVC route you have mentioned in the route is
id = UrlParameter.Optional
. So you should have your parameter as id not x.
If you wish to use x, then you should access your url like:-
/Home/showAll?x=123
Then you will see the value 123 when the action method debugger gets hit.
I hope you understand what I meant.
Please post back your queries if any.
Thanks