ADO.NET 实体数据模型 - MVC - 管理一对多关系
假设我有以下情况。
我有很多客户,也有很多顾问,而每个客户只派了一名顾问。所以这是一对多的关系。
我创建了显示 customer_name 和 customer_consultant_id 的编辑视图,发布后我应该如何更新信息?仅仅 UpdateModel 不起作用,所以需要更多的东西。有什么想法吗?
Let's say that I have following situation.
I have many customers and many consultans, and each customer has attached only one consultant. So it's one-to-many relationship.
I created Edit view which display customer_name and customer_consultant_id how should I update information after post? Just UpdateModel does not work, so something more is needed. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要将数据从网页获取到控制器,请查看 Scott Hanselman 的这篇文章:
用于模型绑定到数组、列表、集合、字典的 ASP.NET 有线格式
To get the data from your web page to the controller, have a look at this article from Scott Hanselman:
ASP.NET Wire Format for Model Binding to Arrays, Lists, Collections, Dictionaries
以下两个链接似乎完全回答了我的问题:
ASP.NET MVC、实体框架、一对多和多对多插入
ASP.NET MVC,实体框架,修改一对多和多对多关系
Those following two links seems to be completly answering my question:
ASP.NET MVC, Entity Framework, One-to-Many and Many-to-Many INSERTS
ASP.NET MVC, Entity Framework, Modifying One-to-Many and Many-to-Many Relationships