1
我有一个简单的模型,我的asp.net核心控制器:asp.net核心定制的模型绑定只为一个属性
[HttpPost]
public async Task<DefaultResponse> AddCourse([FromBody]CourseDto dto)
{
var response = await _courseService.AddCourse(dto);
return response;
}
我的模式是:
public class CourseDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Genre { get; set; }
public string Duration { get; set; }
public string Level { get; set; }
public string AgeRange { get; set; }
public string Notes { get; set; }
public bool Active { get; set; }
public string OrganisationCode { get; set; }
}
我想使用自定义模式联编程序或操作筛选器设置“OrganisationCode”的值,但没有成功。 如果你建议在执行动作之前更新ethe模型的方法是什么,那么我会觉得这是一个愚蠢的行为。
谢谢。
请提供有关要绑定到OrganisationCode属性的数据来源的更多信息。它是否与其他名称一起公布? –