PaymentDetail の場合、ビューでこれを使用します。
@using(Html.BeginForm("PAymentDetail","Quote",FormMethod.Post))
{
//Form element here
}
結果のhtmlは
<form action="/Quote/PAymentDetail" method="post"></form>
顧客詳細も同様
@using(Html.BeginForm("CustomerDetail","Quote",FormMethod.Post))
{
//Form element here
}
その助けを願っています。これらのメソッドの名前が異なる限り、同じコントローラーに 2 つの post メソッドを使用しても問題はありません。
FormCollection 以外のより良い方法として、これをお勧めします。まず、モデルを作成します。
public class LoginModel
{
public string UserName { get; set; }
public string Password { get; set; }
public bool RememberMe { get; set; }
public string ReturnUrl { get; set; }
}
次に、ビューで:
@model LoginModel
@using (Html.BeginForm()) {
<fieldset>
<div class="editor-label">
@Html.LabelFor(model => model.UserName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.UserName)
//Insted of razor tag, you can create your own input, it must have the same name as the model property like below.
<input type="text" name="Username" id="Username"/>
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Password)
</div>
<div class="editor-label">
@Html.CheckBoxFor(m => m.RememberMe)
</div>
</fieldset>
}
これらのユーザー入力はコントローラーにマップされます。
[HttpPost]
public ActionResult Login(LoginModel model)
{
String username = model.Username;
//Other thing
}
頑張ってください。