Walkthrough chapter typo/code correction

Mar 17, 2009 at 3:07 AM
I am not sure if this is the correct place to put this but in the aspnetmvc-nerddinner_v1.pdf on page 103 of 195 there is an error in the example code. 

// GET: /Dinners/Edit/5
public ActionResult Edit(int id) {
Dinner dinner = dinnerRepository.GetDinner(id);
ViewData["Countries"] = new SelectList(PhoneValidator.AllCountries,dinner.Country);
return View(dinner);

The PhoneValidator class does not have an enumeration called AllCountries. It should say PhoneValidator.Countries.   This is repeated in the code blocks for the Using the ViewData Dictionary section, in reference to changing the Country textinput field into a dropdownlist. 

Aside from this minor issue, this is a spectacular walkthrough and introduction to MVC!  I cannot wait to finish going through the walkthrough, and for the UPS man to bring my copy of the book when its released!

Mar 31, 2009 at 6:24 PM
Thanks, this should be fixed now.
Apr 1, 2009 at 9:06 AM

Pages 84, 89, 90, 99

You have  Modelstate.AddRuleViolations(..) and it should be Modelstate.AddModelErrors(...)


Page 109

You have ModelState.AddModelErrors(dinnerToCreate.GetRuleViolations());

It should be ModelState.AddModelErrors(dinner.GetRuleViolations());

You have return View(new DinnerFormViewModel(dinnertoCreate));
It should be return View(new DinnerFormViewModel(dinner));

Jul 8, 2010 at 12:49 AM
Edited Jul 8, 2010 at 10:15 PM
shanselman wrote:
Thanks, this should be fixed now.


It's not fixed in the online tutorial http://nerddinnerbook.s3.amazonaws.com/Part6.htm