如何处理MVC中的页面流(特别是asp.net)

时间:2022-05-24 03:29:06

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

如果您必须在mvc中提供类似表单输入体验的向导,您将如何抽象页面流?

5 个解决方案

#1


9  

Investigate the post-redirect-get pattern.

调查post-redirect-get模式。

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.

使用它与强大的域模型(用于跟踪步骤或形成完成状态或任何你称之为)并且你是金色的。

#2


1  

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();
}

#3


1  

I left the page flow up to the view, where I believe it belongs, so different views could have different page flows (e.g. for desktop browser clients or mobile phone clients etc.) I wrote it up on my blog: A RESTful Wizard Using ASP.Net MVC… Perhaps?

我将页面流向左视图,我相信它属于视图,因此不同的视图可能有不同的页面流(例如桌面浏览器客户端或手机客户端等)。我在我的博客上写了:使用ASP的RESTful向导.Net MVC ......也许吧?

#4


0  

public class CreateAccountWizardController : Controller
{
   public ActionRresult Step1()
   {
   }


   public ActionResult Step2()
   {
   }
}

#5


-1  

There are a couple ways, create an action for each step of the wizard process, or create a parameter that is passed in to the action method. Like step that will allow you to know what the state of the wizard is in.

有两种方法,为向导过程的每个步骤创建一个操作,或者创建一个传递给action方法的参数。像步骤一样,可以让你知道向导的状态。

#1


9  

Investigate the post-redirect-get pattern.

调查post-redirect-get模式。

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.

使用它与强大的域模型(用于跟踪步骤或形成完成状态或任何你称之为)并且你是金色的。

#2


1  

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();
}

#3


1  

I left the page flow up to the view, where I believe it belongs, so different views could have different page flows (e.g. for desktop browser clients or mobile phone clients etc.) I wrote it up on my blog: A RESTful Wizard Using ASP.Net MVC… Perhaps?

我将页面流向左视图,我相信它属于视图,因此不同的视图可能有不同的页面流(例如桌面浏览器客户端或手机客户端等)。我在我的博客上写了:使用ASP的RESTful向导.Net MVC ......也许吧?

#4


0  

public class CreateAccountWizardController : Controller
{
   public ActionRresult Step1()
   {
   }


   public ActionResult Step2()
   {
   }
}

#5


-1  

There are a couple ways, create an action for each step of the wizard process, or create a parameter that is passed in to the action method. Like step that will allow you to know what the state of the wizard is in.

有两种方法,为向导过程的每个步骤创建一个操作,或者创建一个传递给action方法的参数。像步骤一样,可以让你知道向导的状态。

相关文章