When trying to update a DateTime field using the EpicorRESTAPICore nuget package, the post response is an “Unable to deserialize entity” error.
This same method works with any other data type, but fails for the DateTime type.
public async Task<Structure> ChangeNeedByDate(Structure structure)
{
try
{
DateTime? needBy = structure.NeedBy_c;
MultiMap<string, string> structureParams = new()
{
{ "$select", StructureColumns }
};
var getResponse = await EpicorRest.BoGetAsync(StructureService, $"{StructureMethod}('{EpicorRest.Company}', '{structure.Key1}', '{structure.Key2}', '', '', '')", structureParams);
DbStructure updateStructure = JsonConvert.DeserializeObject<DbStructure>(getResponse.Response.Content);
updateStructure.NeedBy_c = needBy;
var postResponse = await EpicorRest.BoPostAsync(StructureService, StructureMethod, updateStructure);
if (postResponse.IsErrorResponse)
{
throw new Exception($"ResponseBody: {postResponse.ResponseBody}");
}
return JsonConvert.DeserializeObject<Structure>(postResponse.Response.Content);
}
catch (Exception)
{
throw;
}
}
