0

I have a large form that I've broken down into three smaller views. I want to detect with the user has already filled one step or more and redirect him accordingly. I am just trying to figure out a good solution for this. The user will be submiting data using the POST method from step to step - posting because I don't want that data be visible on the user URL (GET). The problem is that when there's session data telling that the user filled some step I want to post to the next step "programmatically", in the controlller, but I don't know how to do it.

This doesn't pass data...

  return RedirectToAction("PostDadosContato", new { dadosPessoais = dadosPessoais,  precompletado = true });

to this.

    public IActionResult PostDadosContato(DadosPessoais dadosPessoais, bool precompletado = false)
    {
    }

See in this picture.

enter image description here

Diego Alves
  • 2,462
  • 3
  • 32
  • 65
  • Post code, not images – Shyju Jun 05 '18 at 22:27
  • 1
    Redirect will make the browser to issue a new GET request. What is the point of redirecting to a POST method ? Take a look at this [How do I include a model with a RedirectToAction?](https://stackoverflow.com/questions/11209191/how-do-i-include-a-model-with-a-redirecttoaction/11209320#11209320) – Shyju Jun 05 '18 at 22:28
  • If I cannot redirect to a POST method I don't know what to do. If I use GET methods I will lose my requirement of not showing user data on the browser URL and if I use POST methods I cannot pass data programmatically on the controller. Maybe I wil have to think in another approach. – Diego Alves Jun 05 '18 at 22:32
  • 1
    You can still do redirect with GET(PRG pattern). Read the TempData section of the answer i linked above – Shyju Jun 05 '18 at 22:34
  • So you want to create a workflow with a set amount of stages. When a user has completed stage 1 he can go to stage 2 and revisit s1. If he has completed stage 2, he will go to stage 3 and is able to revisit stage 1 / 2, is that corect? – Marco Jun 06 '18 at 18:54

0 Answers0