I have a base controller with the following abstract method:
[HttpDelete]
public abstract Task Delete(int id);
In one
Apart from ignoring the above warning, is there a better alternative (ie. changing the code above) so that this warning doesn't occur?
The alternative is to remove the async
modifier and use Task.FromResult
to return a Task
:
public override Task Delete(int id)
{
return Task.FromResult(
ResponseMessage(Request.CreateResponse(
HttpStatusCode.MethodNotAllowed,
new NotSupportedException())));
}