モデル バインディングを使用して、コントローラーの見栄えを良くしたいと思います。モデル バインディングを使用すると、どれだけ優れているかがわかります。
public ActionResult Create(Person personToCreate)
{
//Create person here
}
対
public ActionResult Create(string firstName, string lastName, string address, string phoneNum, string email, string postalCode, string city, string province, string country)
{
//Create person here
}
モデル バインディングを行うときは、正しい名前のフォームを使用できます。Html.TextBox("")
jqueryはどうですか?$.post(url, data, callback, dataType)
またはその$.ajax(options)
呼び出しを行うときにCreate(Person personToCreate)
、Person オブジェクトが適切に入力されるようにするにはどうすればよいですか?