Skip to main content

Personalizing TopPicks

To implement personalization of the TopPicks page, we are going to:

generated description: selectingqueryruntime 20111

  • Add a new query, TopCategory, to the Film class.

  • Enhance the TopPicks page so that, when it is displayed, it selects a query dynamically, based on the presence or absence of the cookie.

  • Add code so that the page displays the name of the genre of film for which the user last ordered tickets.

Let's start by adding the TopCategory query to the Film class. It is identical to the previously-defined TopFilms query except that it selects films for a specific category. The code for the query is available here. Note that where TopFilms had single condition, based on the PlayingNow property, TopCategory adds a second condition using the Category property. Note that it compares the Category value to that of a parameter, P1, that will be passed to it at runtime.

There is also one small change that must be made to TopFilms. You can see that change here.

FeedbackOpens in a new tab