// PUT: odata/TodoItems(5)
public IHttpActionResult Put([FromODataUri] string key, Delta
{
Validate(patch.GetEntity());
TodoItem todoItem = db.TodoItems.Find(key);
if (todoItem == null)
{
return NotFound();
}
patch.TrySetPropertyValue("CreatedAt", todoItem.CreatedAt);
patch.Put(todoItem);
db.SaveChanges();
return Updated(todoItem);
}
Grid:
@Html.EJS().Grid("OData").DataSource(dataManger =>
{
dataManger.Url("/odata/TodoItems").CrossDomain(true).Adaptor("ODataAdaptor");
})....
// PUT: odata/Products(5)
public IHttpActionResult Put([FromODataUri] int key, Delta<Product> patch)
{
. . .
return Json(product); //Return as Json
}
|