I have two overload for method Index one without parm and the second have string searchText parm
And when click on ActionLink it take me to the first overload (without parm)
@Html.ActionLink("value", "Index", "Home", new { searchText = "value" }, new { @class = "btn-link" })
public IActionResult Index()
{
AccountDetailsViewModel _accountDetails = new AccountDetailsViewModel
{
Registration = new VmRegistration()
};
_accountDetails.IsSuccess = false;
_accountDetails.ErrorDesc = "";
return View(_accountDetails);
}
[HttpPost]
public IActionResult Index(string searchText)
{
if (string.IsNullOrEmpty(searchText))
return View("Index", new AccountDetailsViewModel());
var _accountDetails = AccountDetailsLogic.GetAccountDetails(searchText.Trim());
return View("Index", _accountDetails);
}