Routing with multiple parameters when browsing

Sep 7, 2011 at 6:37 AM

Hello guys. I have made some changes on the project and created a drop-down menu that displays both Artists and Genres and in addition I've created a new column on Albums for rare albums on the database. This is what I'm trying to achieve on the menu:

Browse by Genres
[Genres]
Browse by Artist
[Artists] 
Rare Records
Browse by Genres
[Genres]
Browse by Artist
[Artists] 

So, if the user clicks on "Browse by Artist" or "Browse by Genre" on the "Rare Records" section, it would show only the rare items for this artist or genre, even if the same artist or genre has other items on the store that are not rare. The URL would be something like "/Store/Browse?cod=10&rare=1" but I don't have any idea how to start this.

I have tried adding a public int Album.Imports { get; set; } on the Artist and Genre models and different approaches on StoreController but I don't know what to put on the Browse method.

        public ActionResult Browse(string genre, int cod)
        {
            // Retrieve Genre and its Associated Albums from database
            var genreModel = storeDB.Genres.Include("Albums")
                .Single(g => g.GenreId == genre);

            return View(genreModel);
        }

I'm also stuck on the GenreMenu. What would I have to change on the partial view to retrieve the data inside Albums table and sort the list based on that value?

    <ul class="sub-menu">
    @foreach (var genre in Model)
    {
        <li>@Html.ActionLink(genre.Name,
                "Browse", "Store",
                new { Genre = genre.Name }, null)
        </li>
    }
    </ul>

Thanks!