问题描述
我有一对多关系的模型。我想使用一个电话插入数据。您能帮我怎样为我的控制器写我的? 我正在使用 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 (将#修改为@)