是否可以通过同一视图同时编辑两个实体? [英] Is it possible to edit two entities at the same time through the same view?

查看:101
本文介绍了是否可以通过同一视图同时编辑两个实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想问下面的问题:



是否可以编辑两个实体同时通过相同的视图?



例如:

i有患者有患者数据(姓名,姓氏等)并且该患者与一个家庭有关系,我有一些家庭记录和日期。



我希望能够编辑该家庭中所有患者的数据以及家庭数据本身同时保存我的更改。



数据是字符串数据。

Hi,

I want to ask the following question:

Is it possible to edit two entities at the same time through the same view?

For example:
i have a patient that has patient data (name, surname etc) and that patient has a relationship with a family which i have some Family notes and date.

I want to be able to edit the data of all patients in that family as well as the family data itself at the same time and save my changes one time.

The data are string data.

推荐答案

创建一个包含两个实体的viewmodel,然后在视图中绑定到两者以及所需的任何其他属性。这就是视图模型的用途,用于创建特定于视图的模型数据组合。



假设您希望页面回发。如果你想使用AJAX,那么你可以在javascript中创建发送到你的AJAX查询的对象,当然,这更加复杂。
Create a viewmodel that contains both your entities, and then you will have binding to both, and any other properties you need, in your view. That's what viewmodels are for, to create a combination of model data that is specific to your view.

That's assuming you want your pages to post back. If you want to use AJAX, then you can just create objects to send to your AJAX queries, in javascript, but that's more involved, of course.


这篇关于是否可以通过同一视图同时编辑两个实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆