0
我想通過Razor形式傳遞兩個對象。怎麼做? 這是我實現如何在Razor表單中傳遞多個對象?
//控制器
public string MatchHotel(HotelPairToMatch HotelPair)
{
return "Hotel matched successfully ";
}
//型號
public class HotelPairToMatch
{
public MapHotel NewHotel { get; set; }
public MapHotel MatchedHotel { get; set; }
}
//模板
@foreach (Clarifi.UI.Models.MapHotel hotel in Model.MatchedHotelsList)
{
<tr>
<td align="left" valign="middle" class="font13">
@using (Html.BeginForm("MatchHotel", "MapNewHotel", new {NewHotel=Model.NewHotel,MatchedHotel=hotel }, FormMethod.Post, new { @class = "pull-left mrs" }))
{
<input type="submit" value="Match" class="submitLink"/>
}
</td>
</tr>
}