相关疑难解决方法(0)

asp.net核心自定义模型绑定器只适用于一个属性

我的asp.net核心控制器有一个简单的模型:

[HttpPost]
public async Task<DefaultResponse> AddCourse([FromBody]CourseDto dto)
{
     var response = await _courseService.AddCourse(dto);
     return response;
}
Run Code Online (Sandbox Code Playgroud)

我的模型是:

 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 …
Run Code Online (Sandbox Code Playgroud)

model-binding custom-model-binder asp.net-core-mvc asp.net-core

7
推荐指数
2
解决办法
2566
查看次数