View Single Post
  #1 (permalink)  
Old July 18th, 2010, 12:39 AM
Darthus Darthus is offline
Registered User
 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 2 Times in 1 Post
Default NerdDinner ViewModel Errata

Hey guys,

Noticed some errata in the ViewModel section. I figured I would post it here so other users could see it if they get stuck. Seemed pretty big and had me stuck for a while, so wanted to share.

First, on page 88, it tells you to create a DinnerFormViewModel class, but doesn't say where, the namespace, usings etc. It appeared to be a model, as it uses the Dinner class. So I put it there and made it part of that namespace. I confirmed this is how it is in the NerdDinner 2.0 download zip as well.

However, on page 89 it says to update the inheret tag on your edit page to: Inherits=‚ÄĚSystem.Web.Mvc.ViewPage<NerdDinner.Con trollers.DinnerFormViewModel>

So... I think that's wrong, should be Models, not controllers.

That's a smaller one, the big one that stuck me was Code snippet 1-52 on the bottom of page 89 start of page 90. It tells you to update your view code for your edit page, but aside from changing the SelectFor tag to consume the new Country SelectList, it doesn't have any of the other number of updates you need to do.

Since you're using the ViewModel now, you need to have everything else use m.Dinner.(property). This also needs to be done to the Create page as well of course, (though you combine them in the next section).

Hope this helps someone.
The Following 2 Users Say Thank You to Darthus For This Useful Post:
athosghost (September 7th, 2010), NightKoder (September 20th, 2010)