我是新來MVc4,並試圖從一個操作參數傳遞給另一個(在另一個控制器)廣東話從一個動作重定向到另一個MVC4
public ActionResult Index(ViewModel.Example search)
{
if (search.Request != null)
{
Session["RoomTypeID"] = search.Request.RoomTypeID;
Session["Breakfast"] = search.Request.Breakfast;
Session["Currency"] = search.Request.Currency;
}
vm.listRoomRate = GetDataIndex(vm.Request);
_UserSession.SearchRoomRate = vm;
return RedirectToAction("SearchResult");
}
[HttpPost]
public ActionResult New(ViewModel.Rate.RateViewModel vm)
{
if (vm.NewRoomRate.Currency == null)
vm.NewRoomRate.Currency = "IDR";
var NewData = _RoomRateService.NewRoomRate(vm.NewRoomRate.RoomTypeName, vm.NewRoomRate.Breakfast,
Convert.ToDateTime(vm.NewRoomRate.CheckInFrom), Convert.ToDateTime(vm.NewRoomRate.CheckInTo), vm.NewRoomRate.sun, vm.NewRoomRate.mon, vm.NewRoomRate.tue,
vm.NewRoomRate.wed, vm.NewRoomRate.thu, vm.NewRoomRate.fri, vm.NewRoomRate.sat, vm.NewRoomRate.Currency, vm.NewRoomRate.SingleRate,
vm.NewRoomRate.DoubleRate, vm.NewRoomRate.TripleRate, Convert.ToDecimal(vm.NewRoomRate.Commision), Convert.ToInt32(vm.NewRoomRate.Allotment), vm.NewRoomRate.CloseSelling,
vm.NewRoomRate.FreeSell);
if (NewData == null)
{
ModelState.AddModelError("failed", "Error has occured");
return New();
}
ViewModel.Rate.RateViewModel test = new ViewModel.Example();
test.Request = new ExampleData();
test.Request.RoomTypeID = Convert.ToInt32(v..exampleVM2);
return RedirectToAction("Index", new {search = test.Request });
}
我得到的參數字典的錯誤,但我有不知道問題是什麼