Reputation: 5150
We have a job application that uses a two step process. I need to tweak this slightly. The easiest way I can see doing this is removing the application creation stage from step one, and just passing it to step two which is a separate view.
Page 1 - Step 1
public ActionResult Apply(JobApplicant jobapp, string HiddenJobId)
{
jobapp.JobID = Convert.ToInt32(HiddenJobId);
//JobsHelper.CreateJobApplicant(jobapp);
return View("ApplyResume", jobapp);
}
The above code used to CreateJopApplication()
. I commented this out and am now passing this to the next step/page.
However once on this new page I then have an [HttpPost]
that takes that jobapp
but at this point it is all null.
The jobapp(JobApplication) is about 140 columns, I'd hate to have to create a hidden text field for all of that. Is there an easier way to pass a model across two pages?
Step 2 - Page 2
[HttpPost]
public ActionResult Upload(HttpPostedFileBase file, string applicantId, string coverLetter, JobApplicant jobapp)
{
// jobapp is null during this entire step, passed in null its as if the page before never had it.
JobsHelper.CreateJobApplicant(jobapp);
.......
Upvotes: 0
Views: 440
Reputation: 11340
You may be able to use TempData
. It is like a session state but it's removed once it gets used. It is good for one round trip.
With a stateless framework like MVC, you can:
Upvotes: 1