我有一个带有HttpDelete请求的api。但是当我调用它时,每次参数为null。
我检查了一下,不起作用:
[HttpDelete("{id}")]
public async Task<IActionResult> Delete([FromRoute] DeletePersonnelCommand command)
{
.....
}
public class DeletePersonnelCommand : ICommand
{
public Guid Id { get; }
[JsonConstructor]
public DeletePersonnelCommand(Guid id)
{
Id = id;
}
}
我也对此进行了研究。但不起作用:
[HttpDelete("delete/{id:guid}")]
public async Task<IActionResult> Delete([FromRoute] DeletePersonnelCommand command)
{
await Dispatcher.SendAsync(command);
return Ok();
}