Code below:
[HttpGet]
public ActionResult Edit(string id="")
{
// ...
}
[HttpPost]
public ActionResult Edit(string itemId="", EditViewModel viewModel)
{
// ...
RedirectToAction("Edit", new { id = itemId });
}
returns an error: "Optional parameters must appear after all required parameters".
I assume it’s trying to redirect to [HttpPost] action.
How to redirect to [HttpGet] action?
I’m trying to implement Save functionality where it will save the edit and reload the form with new values.
Error message is clear…
… if you know that an optional parameter is a parameter with a default value (empty string in your case)
and you’re done