更新时间:2023-02-15 12:30:10
您不能用相同的路线定义两个动作。动作选择器不考虑其参数类型。因此,为什么不合并此操作;
You can't define two actions with same route. Action Selector doesn't consider their parameter types. So, why don't you merge this actions;
public async Task<IActionResult> postObj([FromBody]EntireData data)
{
if (data.FirstClass != null)
{
//Do something
}
if (data.SecondClass != null)
{
//Do something
}
}
public class EntireData
{
public FirstClass firstClass { get; set; }
public SecondClass secondClass { get; set; }
}