views:

41

answers:

1

On a MVC 2 website what I want to do is get a list of products / CategoryId. From that list, create a list of distinct CategoryId's. Then randomly pick a categoryId from the second list and use it to get all the products for that categoryId. I then want to store that CategoryId so that I don't display those products on the next run.

I don't need any code examples to start. What I'm wondering is that I think I would put this code in a class in my model (Dll) and store the list of displayed CategoryId's in session. Is this a good solution or should I go another way?

Thank you for you help

+1  A: 

This could all belong to your Product model, using methods like getAllProductsByCategoryId(id) and maybe use a Category model to do the reverse.

dhdean
So would it be okay to store the list of displayed categoryId's in session?
Sessions should be okay.
Tilo Mitra
First of, thanks dhdean and Tilo for your answers. I have one more question. In my domain model (dll) I have and IQueryable<T> function where I would be putting this code. How do I either pass a Session var into this function or use the HttpSessionStateWrapper or Base to get and store Session data? Thanks again