I am trying to display a successful/unsuccesful message after attempting a stored procedure. My Save ActionResult is called on Save button click - however before I redirect back to the index I want to display a message box. Is there a way to return a view first, and then RedirectToAction?
Save button points to:
[HttpPost]
public ActionResult Save(string submit, Models.KnownIssues knownIssue)
{
UpdateKnownIssue(knownIssue);
InsertKnownIssue(knownIssue);
return RedirectToAction("Index");
}
The viewbag alerts:
public ActionResult Edit(KnownIssues knownIssue, string submit)
{
if (UpdateKnownIssue(knownIssue))
{
ViewBag.ShowAlert = "<script>alert('Successfully Edited'); window.location.href = '/KnownIssues';</script>";
} else
{
ViewBag.ShowAlert = "<script>alert('Unseccessful. Try again.');</script>";
}
return View(knownIssue);
}