I'm creating a C# MVC program in which users can rent tractor equipment. The user will choose the type of tractor they want (bulldozer, roller, etc), then be directed to a screen where they can choose a manufacturer who makes that type of tractor (Caterpillar, John Deere, etc). Next, they will be directed to a list of available models of that type of tractor from that manufacturer.
The goal is to have a ViewModel store their input at each step so that I have a collection of their decisions at checkout. If it matters, the only data I'm storing in each step is the specific ID for each choice, and this is being done all in a single Controller using several Actions. At the end, the user will have the option of adding another tractor to their rental ticket, or simply checking out as is. Therefor, I need a way to initialize a new ViewModel object when a new rental form is started, but not create the new ViewModel object if they choose to add more tractors to their current ticket.
My bottom line issue is that I cannot seem to find a way to create a ViewModel in the first step of the rental procedure that will then persist through the entire process, storing data as it goes.
I can post code snippets if it's necessary, but I mostly just need to know how to create a persistent ViewModel object
TempDataorSessionor even save a partial transaction in a database table.