Я хочу передать данные из значения Textbox в контроллер. Значение Textbox его строка и на контроллере, он должен быть преобразован в double. Но я, похоже, не смогу представить код ниже. Я не знаю, почему код не работает.
=== КОД ПРОСМОТРА ===
@using (Html.BeginForm("OnceOff"))
{
<div class="container">
<div class="bg hidden-sm"></div>
<div class="row">
<div class="col">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Once-Off Payment</h3>
</div>
<div class="panel-body">
<input type="text" id="smsbundles" name="smsbundles" value="50" />
</div>
<div class="text-right">
@Html.ActionLink("Buy Now", "OnceOff", "Home", new { area = "" }, new { @class = "btn btn-block btn-success" })
</div>
</div>
</div>
</div>
</div>
}
=== КОНТРОЛЛЕР ===
public ActionResult OnceOff(string smsbundles)
{
double bundle = Convert.ToDouble(smsbundles);
var onceOffRequest = new PayFastRequest(this.payFastSettings.PassPhrase);
// Merchant Details
onceOffRequest.merchant_id = this.payFastSettings.MerchantId;
onceOffRequest.merchant_key = this.payFastSettings.MerchantKey;
onceOffRequest.return_url = this.payFastSettings.ReturnUrl;
onceOffRequest.cancel_url = this.payFastSettings.CancelUrl;
onceOffRequest.notify_url = this.payFastSettings.NotifyUrl;
// Buyer Details
onceOffRequest.email_address = "";
// Transaction Details
onceOffRequest.m_payment_id = "***";
onceOffRequest.amount = bundle; //30 or 50
onceOffRequest.item_name = "Once off option";
onceOffRequest.item_description = "Some details about the once off payment";
// Transaction Options
onceOffRequest.email_confirmation = true;
onceOffRequest.confirmation_address = "****";
var redirectUrl = $"{this.payFastSettings.ProcessUrl}{onceOffRequest.ToString()}";
return Redirect(redirectUrl);
}