This project is read-only.

My review

Sep 27, 2011 at 7:42 PM
Edited Sep 27, 2011 at 7:43 PM

I have finished this tutorial. Although it gives more explanations
than book based on the same example project
but still some chapters lack explanations. From chapter 8 to the end
author doesn't give detailed explanation of written code,
on the other hand first chapters spend to much time on simple things.

I have found two bugs in MVC Music Store project.

First bug.
Edit action in StoreManagerController doesn't work at all
[Bind(Exclude = "AlbumId")]
public class Album

2. Edit.cshtml doesn't post AlbumId value,
i.e. it is always equal to 0.
To correct this add to Edit.cshtml

@Html.HiddenFor(model => model.AlbumId)

below <legend>Album</legend> line
and remove [Bind(Exclude = "AlbumId")]


Second bug.
GetTopSellingAlbums method in HomeController doesn't work correctly,
e.g. if user A buys 1 album titled "Tiltle1" and buys 10 copies
of album titled "Best Seller", and user B buys 1 album titled "Tiltle1",
then GetTopSellingAlbums method will give incorrect result
saying that more copies of album "Tiltle1" were sold than album
"Best Seller".
Here is corrected version of this method:   

private List<Album> GetTopSellingAlbums(int count)
    return db.Albums
        .OrderByDescending( a => (from od in a.OrderDetails
                                  select od.Quantity).Sum() )