Hi,
|
<div>
<ejs-grid id="Grid" allowPaging="true" actionFailure="failure">
...
</ejs-grid>
</div>
<script>
function failure(args) { //Share whatever you get in this args.
debugger;
}
</script> |
|
[HttpPut]
public object Put(int id, [FromBody]OrdersDetails value)
{
var ord = value;
OrdersDetails val = OrdersDetails.GetAllRecords().Where(or => or.OrderID == ord.OrderID).FirstOrDefault();
val.OrderID = ord.OrderID;
...
return value;
} |
The example is for webapi ... I have OData Controller
Found the problem, since my PUT method return IActionResult, I have to set result as Ok(object).
With Update(object), No Content(object) or Accepted(object) dont work.
|
[Index.cshtml]
<ejs-grid id="Grid">
//Here the URL is a localhost link which is taken from the ODataV4 service project
...
</ejs-grid>
[OrdersController.cs]
public async Task<Order> Put(int key, [FromBody]Order order) //Edit operation in database
{
var entity = await db.Orders.FindAsync(order.OrderID);
db.Entry(entity).CurrentValues.SetValues(order);
await db.SaveChangesAsync();
return order;
} |