Hi There!
dotnet 5.0 - Blazor WASM hosted.
AspNetCore.Odata 8.0.3
I have OData set up in accordance with Microsoft.AspNetCore.Odata spec, and can successfully post new records to this controller manually using Microsoft.Odata.Client (7.9.4) from my client app. So i know the odata endpoint / controller / actions are routing correctly and working.
SfGrid successfully reads and updates existing records using the edit mode (dialog, with template form).
However when I try to write a new record i get the following error back from the server with no opportunity to debug or inspect the modelstate.
- {type: "https://tools.ietf.org/html/rfc7231#section-6.5.1",…}
- errors: {"": ["The input was not valid."]}
- status: 400
- title: "One or more validation errors occurred."
- traceId: "00-090616ce7c52b144b7fc9ae3310c6bca-b5dcb1dc81b15040-00"
- type: "https://tools.ietf.org/html/rfc7231#section-6.5.1"
My controller is quite simple:
public async Task<IActionResult> Post(T item)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
_dbSet.Add(item);
await _dbContext.SaveChangesAsync();
return new CreatedODataResult<T>(item);
}
I was hoping somebody had a working example of creating records using odatav4adapter and aspnetcore.odata 8.0.3 that I could look at. There may well be something wrong with my controller but am unsur