tldr> Once a customer has been selected, how can all other controllers execute their actions always in the 'context' of that customer without manually passing the ID around?
I'm trying to figure out what the 'right' way is to handle the situation where one entire controller (or more) are all dependent on an idea from a previous controller. For instance, let's say you were building some kind of customer management system. There'd be all kinds of customer functions, probably located on CustomerController. But then when you got into order management, you'd likely want to have an OrderController.
If you had only one OrderController, your methods would probably look like:
public ActionResult Edit(string id){...}
The id would be the id of the order, right? Where I get a little lost is when I need to get back to the customer. It's like the 'context' of all the actions taking place are within the customer. You could do this by always adding the customer id onto actions (URLs):
http://site.com/Orders/Edit/1234?customerId=abc
But this seems like it gets quite tedious to be grabbing that value and jamming it onto every action. There are options like Session, but that seems sloppy.
What's the right way to do this?