This should be simple, but the answer is eluding me. If I've got a Save action in my controller, and the save fails, how do I cancel the action without disturbing what the user entered? For example, Index is strongly-typed of "MyTable":
Function Index() As ActionResult
ViewData("message") = "Hello"
Return View(New MyTable)
End Function
<ActionName("Index"), AcceptVerbs(HttpVerbs.Post)> _
Function Save(ByVal form As MyTable) As ActionResult
Try
SaveMyData(form)
Return RedirectToAction("Index")
Catch
AddModelError("form", "An error occurred.")
???
End Try
End Function
In the Catch, if I put Return View(form), I lose the message passed via ViewData. If I redirect to Index, I'll lose what the user entered. I think I've seen the simple (correct) way to handle this before, but if you don't know what to search for, it's hard to find. What am I missing?