Hi, @Coreysan
From your code, I think you just want to pass a string value to another view. And from your description of the question, You seems to think that use:
return RedirectToAction(nameof(Index), new { userstatus = model.UserFound });
to redirect to HttpGet method of Index
is a little bit not clean
.
In my opinion, You can try this code:
[HttpPost]
public IActionResult Privacy(UserStatusViewModel model)
{
if (model.UserFound != null)
{
return View("Index", model.UserFound );
}
return View(model);
}
This code will just return a string (model.UserFound)
to Index
view directly instead of redirecting to another action. I think it is cleaner than using return RedirectToAction(xx)
.
---------------------------------------------------------------------------------------------------------------------------------------------------------
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Xinran Shen