.net core 2.1 webapi并发删除

.net core 2.1 webapi并发删除,.net,asp.net-core,asp.net-core-webapi,.net,Asp.net Core,Asp.net Core Webapi,目前我有一个webapi可以删除ok,但我需要确保只有在提供正确/当前版本的情况下才能删除它们项 我的模型是: public class Item { public int Id {get;set;} .. other properties ... [Timestamp] public byte[] Version {get;set;} } 我当前有以下端点声明: [HttpDelete("{id}")] public IActionResult Dele

目前我有一个webapi可以删除ok,但我需要确保只有在提供正确/当前版本的情况下才能删除它们项

我的模型是:

public class Item {
    public int Id {get;set;}

    .. other properties ...

    [Timestamp]
    public byte[] Version {get;set;}
} 
我当前有以下端点声明:

[HttpDelete("{id}")]
public IActionResult Delete(int id)
{
   ...
}
请有人告诉我,在进行删除之前,发送byte[]版本以进行检查的正确方法是什么

要实现这一点,我需要在上面的删除端点声明中更改什么


提前感谢。

您可以在请求正文中传递时间戳

public class DeleteItemRequest {
    public byte[] Version {get;set;}
} 

[HttpDelete("{id}")]
public IActionResult Delete(int id, [FromBody]DeleteItemRequest request)
{
   ...
}