C# 将通用对象JSX中的对象列表发布(使用fetch)到ASP.Net核心API
我正在使用ReactJS和ASP.NETWebAPI 这就是模型:C# 将通用对象JSX中的对象列表发布(使用fetch)到ASP.Net核心API,c#,reactjs,asp.net-core,asp.net-web-api,arraylist,C#,Reactjs,Asp.net Core,Asp.net Web Api,Arraylist,我正在使用ReactJS和ASP.NETWebAPI 这就是模型: public class Skill { public int Id { get; set; } public string Description { get; set; } } public class RegisterProject { public class Request { public string Objective { get; set; } public string
public class Skill
{
public int Id { get; set; }
public string Description { get; set; }
}
public class RegisterProject
{
public class Request
{
public string Objective { get; set; }
public string Description { get; set; }
public long UserId { get; set; }
public int CurrencyId { get; set; }
public int BudgetId { get; set; }
public List<Skill> Skills = new List<Skill>();
}
public class Response : Models.Common.Generic
})
在下面的控制器调试图像中,我没有收到技能列表,我不知道我的技能定义是否错误,或者是否存在其他问题
请改变这样的技能
public List<Skill> Skills { get; set; }
公共列表技能{get;set;}
“公共列表技能{get;set;}”应该怎么办
fetch(global.config.url + "Project/postRegisterProject/", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
Objective: "a",
Description: "b",
UserId: 1,
CurrencyId: 1,
BudgetId: 1,
Skills: [
{ Id: 1, Description: "ReactJS" },
{ Id: 2, Description: "Html" },
],
}),
})
.then(function (response) {
response.json().then(function (data) {
console.log("llego aqui");
console.log(data);
});
})
.catch(function (err) {
console.log("Fetch Error :-S", err);
});
public List<Skill> Skills { get; set; }