Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I handle page flow in MVC (particularly asp.net)

Tags:

asp.net-mvc

If you had to provide a wizard like form entry experience in mvc how would you abstract the page flow?

like image 796
Dane O'Connor Avatar asked Aug 19 '08 14:08

Dane O'Connor


2 Answers

Investigate the post-redirect-get pattern.

http://weblogs.asp.net/mhawley/archive/tags/MVC/default.aspx
http://devlicio.us/blogs/tim_barcz/archive/2008/08/22/prg-pattern-in-the-asp-net-mvc-framework.aspx

Use that along with a robust domain model (for tracking steps or form completion state or whatever you call it) and you're golden.

like image 113
Matt Hinze Avatar answered Oct 29 '22 10:10

Matt Hinze


In order to keep the steps you could implement a page flow action filters, which provide an experience like this one:

[RequiredStep(FlowStart = true)]
public ActionResult Confirm()
{
    return View();
}

[RequiredStep (PreviousStep = "Confirm")]
public ActionResult ExecuteOrder()
{
    return RedirectToAction("ThankYou");
}

[RequiredStep(PreviousStep = "ExecuteOrder")]
public ActionResult ThankYou()
{
    return View();
}
like image 38
CodeClimber Avatar answered Oct 29 '22 10:10

CodeClimber