Asp.net mvc 3 如何在另一个操作中使用dfd、dtd和soprtr变量?
[HttpPost]Asp.net mvc 3 如何在另一个操作中使用dfd、dtd和soprtr变量?,asp.net-mvc-3,razorengine,Asp.net Mvc 3,Razorengine,[HttpPost] public ActionResult crbtmis(string submitbuttonoperator, DateTime fromdate, DateTime todate, string operatorname) { DateTime dfd = fromdate; DateTime dtd = todate; string soprtr = operatorname; if
public ActionResult crbtmis(string submitbuttonoperator, DateTime fromdate, DateTime todate, string operatorname)
{
DateTime dfd = fromdate;
DateTime dtd = todate;
string soprtr = operatorname;
if (Session["user"] != null && Session["user"].ToString() == "MISADMIN")
{
switch (submitbuttonoperator)
{
case "Export":
return (ExportOprtrlist( fromdate, todate, operatorname));
case "Search":
return (SearchByOperator());
default:
return (View("LogOn"));
}
}
else
{
return RedirectToAction("LogOn");
}
}
我定义了三个变量,分别命名为dfd、dtd和soprtr,并希望将这些变量用于另一个ActionResult。现在请帮助我如何操作?在您的操作中,您可以使用包含一些参数的其他操作:
public ActionResult crbtmis(string submitbuttonoperator, DateTime fromdate, DateTime todate, string operatorname)
{
//..your code
return RedirectToAction("OtherAction", new { dfd = dfd, dtd = dtd, soprtr = soprtr });
}