The checkout process in the MVC Music Store is composed of two parts, adding address & payment options and completing the order.
The old code for address & payment is on the left, the new on the right.
As you can see, they are quite similar. Raven’s code isn’t complete yet, though.
If you’ll recall, we stated that we are going to store the CountSold property inside the Album document, to allow us to easily sort by that count. We now need to write that logic, I put it directly after the call to CreateOrder:
It is important to note that we are loading all the albums document in a single query. And when we save, Raven is going to make a single (batched) call to the server.
And now, merely to completion sake (pun intended) let us look at the Complete method:
I think by now you can tell what is going on in each system. The next post will cover the administration section.
More posts in "Porting MVC Music Store to Raven" series:
- (31 May 2010) StoreManagerController, part 2
- (29 May 2010) StoreManagerController
- (28 May 2010) Porting the checkout process
- (25 May 2010) StoreController
- (24 May 2010) Advanced Migrations
- (23 May 2010) Migrations
- (22 May 2010) Porting the HomeController, the Right Way
- (21 May 2010) Porting the HomeController, the map/reduce way
- (20 May 2010) Data migration
- (19 May 2010) Setting up the application
- (18 May 2010) The data model