【发布时间】:2020-04-27 10:16:26
【问题描述】:
public async Task<IActionResult> AddProjectDetail(ProjectViewModel project)
{
//
}
public class ProjectViewModel : IProjectViewModel
{
public string Id { get; set; }
public IKeyValue UOPSegment { get; set; } = new KeyValue();
public IList<IProjectGateAssocViewModel> ProjectGates { get; set; } //Data is not getting binded here
}
public interface IProjectViewModel : IBaseDBModel
{
string Id { get; set; }
IKeyValue UOPSegment { get; set; }
IList<IProjectGateAssocViewModel> ProjectGates { get; set; }
}
public interface IProjectGateAssocViewModel
{
string GateCode { get; set; }
string GateDate { get; set; }
string ProjectId { get; set; }
}
public class ProjectGateAssocViewModel : IProjectGateAssocViewModel
{
public string GateCode { get; set; }
public string GateDate { get; set; }
public string ProjectId { get; set; }
}
// public IList ProjectGates { get;放; }
这里的数据没有被绑定。 当我尝试调用 API 时出现以下错误:
{ "projectFiles[0].contentType": [ “输入无效。” ] }
【问题讨论】:
标签: class asp.net-core interface asp.net-core-webapi