Hi I am able to call my odata controller with the correct key but I am missing the payload, so delta is null.
How can I set the payload? and also return the updated entity?
datasource definition:
var baseUrl = "odata/reports",
dataSource = new kendo.data.DataSource({
type: "odata-v4",
transport: {
read: {
url: baseUrl,
dataType: "json"
},
update: {
url: (data) => {
return baseUrl + "(" + data.models[0].Id + ")";
},
dataType: "json",
type: "PATCH"
},
destroy: {
url: baseUrl,
dataType: "json",
type: "DELETE"
},
create: {
url: baseUrl,
dataType: "json",
type: "POST"
}
},
webapi odata controller:
public IHttpActionResult Patch(int key, Delta<T> delta)
{
Validate(delta.GetEntity());
if (!ModelState.IsValid)
return BadRequest(ModelState);
var entity = Repository.GetByKey(key);
if (entity == null)
return NotFound();
if (!AuthenticationService.HasWriteAccess(CurentUser, entity))
return Unauthorized();
try
{
delta.Patch(entity);
Repository.Save();
}
catch (Exception e)
{
return InternalServerError(e);
}
return Updated(entity);
}