ASP.NET MVC - Submit Form with complex Model with EntitySet -


I am trying to work with my model with my model ...

My There are 3 models

  account_hon - & gt; Company is_mela - & gt; Individuals - & gt;  

Therefore, there can be a company in the account and many individuals may have a document with it.

When submitting my form, I have the following action:

  [AcceptVerbs (HttpVerbs.Post)] PublicActionershipOpenAinAccount (string field, [bind (remove = " ID ")] Website.Model.Account account) {var db = new DB (); Var type = new int (); Switch (area) {case "business": type = 1; break; Case "Private": Type = 2; break; } If (ModelState.IsValid) {try {account.Type = type; Db.Accounts.InsertOnSubmit (account); Db.SubmitChanges (); See Return ("Open AAACC / Thanks"); } Hold {return (see); }} And {return view (); }}  

and simple things on my form such as

 % label {for = 'companyName'} & lt; Em> * & Lt; / Em> Company as business (if different)% input {id = 'companyTradeName'} {name = 'required' id = 'companyname' name = 'company.Name' type = 'text'}% label {for = 'companyTradeName '} Name =' Company.Trade 'type =' text '}% label {' companyRegistrationNumber '}}  em> * & Lt; / Em> Company registration number% input {class = 'required' id = 'companyRegistrationNumber' name = VAT number (if applicable)% input {id = 'vatNumber' name = 'Company.VAT' type = 'text'}   

which means that I am giving the names of fields as a company. Name, Company. Registration, etc. ... and for the individuals I am doing this

 % label {for = 'firstName_0'} & lt; Em> * & Lt; / Em> First name% input # firstnamename.filled.first name {name = 'persons [0]. First name 'type =' text '}% labels {for =' middleName_0 '} middle name% input # middle name name {name =' individuals [0] .iddleName 'type =' text '}% label {for =' lastName_0 ' } & Lt; Em> * & Lt; / Em> Last name% input # lastName_0.required {name = 'Individuals [0]. Type 'LastName' in the form of individuals [0] = 'text'}  

. First name, Individuals [0]. Small names, etc.

But what is happening is that I am actually building an account with my company, but it is not working for individuals .... it's not doing anything with the database?

Anyone can help me on that?

I have examined some resources like this but it does not work in my case which I feel, because it does not change anything.

Thank you in advance

This answer was a straightforward way of doing this: if Someone needs this


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -