6
我想發送一個字符串和模型(對象)到另一個動作。傳遞模型和參數與RedirectToAction
var hSM = new HotelSearchModel();
hSM.CityID = CityID;
hSM.StartAt = StartAt;
hSM.EndAt = EndAt;
hSM.AdultCount = AdultCount;
hSM.ChildCount = ChildCount;
return RedirectToAction("Search", new { culture = culture, hotelSearchModel = hSM });
當我使用new
關鍵字它發送null
對象,雖然我設置對象hSm
屬性。
這是我Search
行動:
public ActionResult Search(string culture, HotelSearchModel hotelSearchModel)
{
// ...
}