MakePayment.cshmtl ビューでモデルのデータを取得する際に問題が発生しています。
AccountScreen.cshtml は MakePayment.cshtml ビューを呼び出しています。
@model SuburbanCustPortal.SuburbanService.CustomerData
@{
ViewBag.Title = "Account Screen";
}
<h2>AccountScreen</h2>
<div class="leftdiv">
<fieldset>
<legend>customer info</legend>
@Html.Partial("CustomerInfoPartialView", Model)
</fieldset>
<fieldset>
<legend>delivery address</legend>
@Html.Partial("DeliveryAddressPartialView", Model)
</fieldset>
<fieldset>
<legend>delivery info</legend>
@Html.Partial("DeliveryInfoPartialView", Model)
</fieldset>
</div>
<div class="rightdiv">
<fieldset>
<legend>balance</legend>
<div>
@Html.Partial("BalancePartialView", Model)
</div>
</fieldset>
<fieldset>
<legend>payment</legend>
<div>
@Html.Partial("MakePayment", Model)
</div>
</fieldset>
<fieldset>
<legend>billing info</legend>
<div>
@Html.Partial("BillingInfoPartialView", Model)
</div>
</fieldset>
</div>
私の MakePayment.cshtml ビュー:
@model SuburbanCustPortal.SuburbanService.CustomerData
@using (Html.BeginForm("MakePayment2", "Customer", FormMethod.Post))
{
<div style="text-align:center;">
<input class="makePaymentInput" type="submit" value="Make a Payment" />
</div>
}
私のカスタマーコントローラー:
public ActionResult AccountScreen(LogOnModel model)
{
return ShowCustomer(model.AccountNumber);
}
public ActionResult MakePayment(CustomerData model)
{
return View("MakePayment", model);
}
[HttpPost]
public ActionResult MakePayment2(CustomerData model)
{
//CustomerData model = new CustomerData();
var newmodel = new PaymentModel.SendToGateway();
newmodel.AccountBalance = model.TotalBalance;
newmodel.Amount = model.TotalBalance;
return RedirectToAction("PrePayment", "Payment", newmodel);
}
public ActionResult MakePayment(CustomerData model)
に到達することはありません。
私の問題:[HttpPost] public ActionResult MakePayment2(CustomerData model)
に到達していますが、モデルにはヌルが含まれています。
レンダリングされている他のビューがデータを表示しているため、AccountScreen のデータ初期モデルが取り込まれていることがわかります。
私が間違っていることを誰かが見ていますか?