How to send data generated from one http post to a second http post in ASP.NET MVC? -


I have a scene that is being used to create an invoice, the process should be as follows: < P> 1. The user specifies a drop down and then a customer with a start date and end date.

2. Then click on the submit button, which is connected to the controller. After this, create an ILI of all the jobs that meet the above criteria.

3. Refresh the page and displays the list of jobs.

4. On the same page, there is another form that asks for an "invoice date" with another submit button. When clicking on this, an invoice table should be updated in my DB, while the employment is restricted through ILI and attach the invoice ID (which is deposited in another table in my DB).

The problem I am facing is that I have created the method which accepts the invoices and the ILI of the jobs, but when I try to cross the ILID on the second submitted controller method I am, so this is zero.

In the above scenario, what is the best way to create ILIT in the first post used in the second term?

The only way I can think, is to use a temporary table to store the list of jobs after the first post and then update the invoice table while reading it in the second I want this to be an acceptable way? Or is there a better way that the lack of experience is missing? XD

What bugs do I have about the above method that if the user leaves the page before posting a second time, then the temporary table will list the scam jobs which will be unexpectedly the next time. Can be called

Hope I have explained this well enough. thank you in advanced.

You can use the temp table (which is created in MVC). It stays within the session, and when you use them the values ​​are removed.

BTW, have you thought of using Ajax instead of posting and context? This means that you always have data as you keep on the same page. You do not have to move around the state.


Update:

When you say that the list is taped, then are you talking about the list you received in your operation as a parameter? If you are, then you know how to databidize a collection.

2 update:

I had second thoughts about this method (getting data from the client), because it has some security issues

if you want DB If you do not want to ask again, TempData / session is a potential solution.

Comments