views:

452

answers:

2

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?

+1  A: 

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

Robert Harvey
I don't find this link helpful for my case I think :(My Customer entity doesn't have consultant_id field, it just have consultant field as another entity. This is why I don't know how to update it.
Inez
+1  A: 

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

Inez