我正在使用ASP.NET MVC的RC1.
我正在尝试扩展Phil Haack的模型绑定示例.我正在尝试使用默认模型绑定器来绑定以下对象:
public class ListOfProducts
{
public int Id { get; set; }
public string Title{ get; set; }
List<Product> Items { get; set; }
}
public class Product
{
public string Name { get; set; }
public decimal Price { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Phil的示例中的代码进行一些更改:
控制器:
using System.Collections.Generic;
using System.Web.Mvc;
namespace TestBinding.Controllers
{
[HandleError]
public class HomeController : Controller
{
public ActionResult Index()
{
ViewData["Message"] = "Welcome to ASP.NET MVC!";
return View();
}
//Action method …Run Code Online (Sandbox Code Playgroud)