I scafolded my database and for previous entities it worked well
But I have this entity that is causing problem.
This is the scaffolded service method:
public async Task<AciRadzen.Server.Models.aci.LstEquip> CreateLstEquip(AciRadzen.Server.Models.aci.LstEquip lstEquip = default(AciRadzen.Server.Models.aci.LstEquip))
{
var uri = new Uri(baseUri, $"LstEquips");
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, uri);
httpRequestMessage.Content = new StringContent(Radzen.ODataJsonSerializer.Serialize(lstEquip), Encoding.UTF8, "application/json");
OnCreateLstEquip(httpRequestMessage);
var response = await httpClient.SendAsync(httpRequestMessage);
return await Radzen.HttpResponseMessageExtensions.ReadAsync<AciRadzen.Server.Models.aci.LstEquip>(response);
}
This is the scaffolded controller method:
[HttpPost]
[EnableQuery(MaxExpansionDepth=10,MaxAnyAllExpressionDepth=10,MaxNodeCount=1000)]
public IActionResult Post([FromBody] AciRadzen.Server.Models.aci.LstEquip item)
{
try
{
if(!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (item == null)
{
return BadRequest();
}
this.OnLstEquipCreated(item);
this.context.LstEquips.Add(item);
this.context.SaveChanges();
var itemToReturn = this.context.LstEquips.Where(i => i.UniteEquip == item.UniteEquip);
this.OnAfterLstEquipCreated(item);
return new ObjectResult(SingleResult.Create(itemToReturn))
{
StatusCode = 201
};
}
catch(Exception ex)
{
ModelState.AddModelError("", ex.Message);
return BadRequest(ModelState);
}
}
Item is always null once it reaches the controller even If i inspected it at service level and the values are there. I did not modify controller or service