我想知道如何在不重定向到该控制器的情况下将值从一个动作传递到另一个动作。
例如,我想将值从“索引”操作传递到“ reservation_step_2”操作,而不必重定向到该页面,而是重定向到我的“ reservation_step_1”页面。
[HttpPost]
public ActionResult Index(string locationId, string dt1, string dt2, string PickUpTime, string DropOffTime)
{
string loc = locationId;
string PUT = PickUpTime;
string DOT = DropOffTime;
DateTime d_in = DateTime.ParseExact(dt2.Trim(), "dd/M/yyyy", System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat);
DateTime d_out = DateTime.ParseExact(dt1.Trim(), "dd/M/yyyy", System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat);
return RedirectToAction("reservation_step_1", "Home", new { d_out = d_out, d_in = d_in, loc = loc, PU_time = PUT, DO_time = DOT});
}
我想将d_out,d_in,PU_time和DO_time传递给“ reservation_step_2”,但将loc传递给“ reservation_step_1”并重定向到“ reservation_step_1”
我该怎么做?