Hi
I'm fooling around with the NerdDinner tutorial Dinner Edit control.
I get a FormCollection as one of the arguments, can I trim the data in it before I use UpdateModel().
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(int id, FormCollection formValues)
{
Dinner dinner = dinnerRepository.GetDinner(id);
try
{
UpdateModel(dinner);
dinnerRepository.Save();
return RedirectToAction("Details", new { id = dinner.DinnerID });
}
catch
{
foreach (var issue in dinner.GetRuleViolations())
{
ModelState.AddModelError(issue.PropertyName, issue.ErrorMessage);
}
return View(dinner);
}
}
Or do I have to do that manually by iterating over the Request.Form keys?