how save 2 entities 1 view. suppose have 2 entities party , person 1 many relation. need save both entities party view. using asp.net mvc4.
public partial class cm_opt_pty_party_s { public cm_opt_pty_party_s() { this.cm_opt_psn_person_s = new hashset<cm_opt_psn_person_s>(); } public int pty_id { get; set; } public nullable<int> pty_partytypecode { get; set; } public string pty_fullname { get; set; } public string pty_govtid { get; set; } public nullable<int> pty_govtidtc { get; set; } public nullable<int> pty_govtidstat { get; set; } public virtual icollection<cm_opt_psn_person_s> cm_opt_psn_person_s { get; set; } }
what can create viewmodel class contain relevant properties needed create both entities.
then base view on viewmodel instead, , pass controller.
when want save entities, can build separate entities , save them.
Comments
Post a Comment