im working with breezejs, and the server-side code of my app is .net.
in my views (client side), i want to add and entity then i want to save it. Lets assume that an entity is like this :
{
"Id": 1,
"Name": "someName",
"CreatedDate": "1900-01-01T05:00:00Z",
"UpdatedDate": "1900-01-01T05:00:00Z",
"CreatedBy": null,
"UpdatedBy": null,
"RowVersion": 0,
etc ...
}
}
i want to set the values of CreatedDate
UpdatedDate
CreatedBy
and UpdatedBy
, i can do that using javascript of course, BUT i dont want the client to take care of those kind of things.
my breeze controller where lives this function is like this:
[HttpPost]
public SaveResult SaveChanges(JObject saveBundle)
{
return _contextProvider.SaveChanges(saveBundle);
}
as u can see the saveBundle is a JObject, when i debug i see the saveBundle like this:
{
"entities": [
{
"Id": 1,
"Name": "someName",
"CreatedDate": "1900-01-01T05:00:00Z",
"UpdatedDate": "1900-01-01T05:00:00Z",
"CreatedBy": null,
"UpdatedBy": null,
"RowVersion": 0,
etc ...
}
}
}
],
"saveOptions": {}
}
How can i change the values of CreatedDate
UpdatedDate
CreatedBy
and UpdatedBy
in the saveBundle before the save is commited ???
this is a JObject with an array of objects as proprety, i can manipulate Json with javascript, how can i do it with .Net ???
Thanks a lot.