1

I have an entity Student. Below is the signature of delete method in ASP.net WebAPI for OData.

public async Task<IHttpActionResult> Delete([FromODataUri] int key)

The Student has composite primary key. When called from Postman, with

http://localhost:52484/Students/1

it doesn't hit the Delete method. But it works with other entity with single primary key.

Any suggestions?

Nands
  • 379
  • 3
  • 19

1 Answers1

2

Kindly prefix param with 'key' for composite key Entity. OData v4

Refer the example below:

    public async Task<IHttpActionResult> Delete([FromODataUri] int keySudentId, [FromODataUri] int keyClassId)
    {
      //Delete code here
    }

OData Url http://localhost:52484/Student(SudentId=1,ClassId=2)