任何輸入大大appriciated :)如何發佈部分查看數據
我想知道一兩件事,我是否能在MVC發佈多個局部視圖中的數據?(指我想更新部分vews數據DATBASE)
下面是實施例:
型號: -
public class PassengerViewModel
{
public List<PassengerModel> Passengers { get; set; }
public ContactModel Contact { get; set; }
}
控制器: -
[RequiredAuthentication]
public ActionResult Passenger()
{
var passengrViewMdl = new PassengerViewModel()
{
Contact = new ContactModel(),
Passengers = psngrService.LoadPassengers(Convert.ToInt32(Session["LPORefNO"]))
};
return View(passengrViewMdl);
}
[HttpPost]
public ActionResult Passenger(PassengerViewModel passengerViewModel)
{
Here i want to update Passengers & Contact information
}
查看: -
@model QR.LPO.Core.Models.PassengerViewModel
@{
ViewBag.Title = "Add Passengers";
}
@using (Html.BeginForm())
{
@Html.Partial("_Passenger", Model.Passengers);
@Html.Partial("_PassengerContact", Model.Contact);
<input type="submit" value="Submit" />
}
感謝。