So I am following ScottGu's NerdDinner tutorials, and am having some trouble wrapping my head around this error. I am trying to implement CRUD, so at first, while editing data, I started with this code:
public ActionResult Edit(int id)
{
Dinner dinner = dinnerRepository.GetDinner(id);
return View(dinner);
}
which displays the Edit View properly, and gives me fields to edit my data. Now, when I continue on and my Edit action turns into this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(int id, FormCollection formValues)
{
Dinner dinner = dinnerRepository.GetDinner(id);
UpdateModel(dinner);
dinnerRepository.Save();
return RedirectToAction("Details", new { id = dinner.DinnerID });
}
I return a 404 error. Apparently the Edit view cannot be found. I am having an extremely hard time understanding why this is happening. I even tried to copy the exact syntax (which I don't like to do.) but no luck. Am I missing something that obvious?
EDIT: I happens as soon as I add this line:
[AcceptVerbs(HttpVerbs.Post)]
maybe that will help?