I'm trying to go through an anchor (HTML) of the view an object on the page, or I click on the anchor it fills the object and it passes it back to the page and it fills a viewModel, I tried as you see below but it doesn't work, how can I do it?
public async Task<IActionResult> GetShellysAsync(string button)
{
shellys = await shellyService.GetShellyAsync("user", "password");
return RedirectToAction("Settings", "Shelly", shellys);
}
public async Task<IActionResult> Settings()
{
ViewData["Title"] = "Setting Shelly";
if(shellys==null)
{
shellys = new List<ShellyViewModel>();
var nd = new ShellyViewModel
{
Ip = "NESSUN",
IdName = "DEVICES"
};
shellys.Add(nd);
return View(shellys);
}
return View(shellys);
}
<a asp-action="GetShellysAsync">search</a>