I have a simple MVC2 app that doesn't seem to Redirect correctly. The code is setup as follows:
[HttpPost]
[Authorize]
public ActionResult QuickAddEvent(CalendarEvent calEvent)
{
if (ModelState.IsValid)
{
int eventID = repo.AddEvent(calEvent);
return RedirectToAction("Event", new { id = eventID });
}
return RedirectToAction("Index", "Home");
}
[ChildActionOnly]
public ActionResult QuickAddEvent()
{
return PartialView();
}
public ActionResult Event(int id)
{
CalendarEvent curEvent = repo.ByID(id);
return View(curEvent);
}
The problem I am running into is that no matter what the ModelState is on HttpPost the page redirects to itself. That is, no matter what the model state is, I always end up at /EventCalendar/Index instead of one of the two specified actions.