Posting From a Post?

时间:2016-02-12 19:33:35

标签: asp.net-mvc

I am trying to learn more about MVC/ASP.NET. I have an issue where I need to POST from a POST.

So I have got the user to select a .csv file locally, I then POST so I can parse this and display it nicely on screen.

I then want the user to be able to edit data and save it to the database. However, this is where I have the issue.

The code to parse the file and load up the correct view is in a POST itself:

    <HttpPost>
    Function Index(file As HttpPostedFileBase) As ActionResult
        fileManager = New FileManager(file)

        Dim bills = From bill In db.Bills
                    Order By bill.Description

        Dim eb As ExpenseBill = New ExpenseBill
        eb.bills = bills.ToList
        eb.expenses = fileManager.getModels(fileManager.Data)

        Return View("postIndex", eb)
    End Function

So when the view 'postIndex' returns from a submission, it calls the same method again. I'm not sure if there is a way to get it to call another method on POST, or if my design is entirely wrong and there's a simpler solution?

0 个答案:

没有答案