I have a Model, which has a drop down list of reference data. The reference data is based on the current user. So, User A sees his records assigned to him, and User B can see different records. The point is, the reference data is based on the userId.
The userId is in the Session. Is there a way for the model to access a session variable? The creation of the SelectionList is built into the model. So, I can put the UserId as a parameter in the constructor – but I need that in all constructors for the model. Seems duplication of work. I’d prefer the model to be able to say, ‘Ah, the current user is User1’ but it’s self.
Possible? Or do I have a design flaw?
How about something like this
Now you can create you WibbleModelBuilder in your controller and pass your repository and userid into the constructor. Your model is now just a very simple data object