gpt4 book ai didi

c# - 在同一页 asp.net mvc 添加模型的两个实例

转载 作者:太空宇宙 更新时间:2023-11-03 10:40:26 25 4
gpt4 key购买 nike

我想同时添加我的模型的两个实例,即用户将在同一页面中输入填写相同的表格,他将同时将两个完整的引用发送到数据库。你知道我怎样才能做到这一点吗?

感谢您的帮助!

最佳答案

你可以做的一件事(我希望我能正确解释你的问题)是这样设置一个模型:

public class Foo
{
public int Id { get; set; }
public string Something { get; set; }
}

public class Bar
{
public Foo Foo1 { get; set; }
public Foo Foo2 { get; set; }
}

在您看来,您将采用 Bar 模型(其中包含两个 Foo 对象)

希望这会有所帮助,如果将具体细节添加到您的问题中,可能会对此进行扩展。

关于c# - 在同一页 asp.net mvc 添加模型的两个实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25527008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com