In the Post method of my controller's function I have added some ModelStateError
. Once added I Redirect to the Get method.
In Get method when I return the view, I want to be able to fetch the error message passed from Post method and add it to Modelstate.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult AttendeeAvailability(params params)
{
...
...
if (some statement)
{
ModelState.AddModelError(string.Empty,Resource.message);
return RedirectToAction("someaction", new { response.AppointmentId, response.AttendeeId });
}
return RedirectToAction("someaction", "somecontroller");
}
now the error that was added, I want to retrieve it in following function
[HttpGet]
public ActionResult AttendeeAvailability(Guid appointmentId,Guid attendeeId)
{
.....
Modelstate.AddModelError()//add message passed from post(if any);
return View(model);
}
Any suggestions??