如何制作用于插入一对多数据的控制器

问题描述

我有一对多关系的模型。我想使用一个电话插入数据。您能帮我怎样为我的控制器写我的? 我正在使用 Asp.net core 3.1。以下是我的详细代码

模型1:已修复

private static HttpClient _httpClient = new HttpClient();
        public static async Task<string> SendAsync(Uri url)
        {
            try
            {
                string result = string.Empty;
                using (var response = await _httpClient.GetAsync(url).ConfigureAwait(false))
                {
                    if (response != null && response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        result = await response.Content.ReadAsstringAsync().ConfigureAwait(false);
                    }
                }
                return result;
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error occurred while sending sms urlLink:{url}",ex);
                throw;
            }
        }

模型2:设施区

 public class FacilityFixed : FullAuditedEntity,IMustHaveTenant{
  public string Name { get; set; } 
  public ICollection<FacilityCompartment> FacilityCompartment { get; set; }
  
  }

控制器

public class FacilityCompartment : FullAuditedEntity,IMustHaveTenant
    {
        public string Name { get; set; }
        public int SensorId { get; set; }
        public FacilityFixed FacilityFixed { get; set; }
       }

我正在Asp.net核心中工作。 Asp.Net零,锅炉板。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...