0
I’m creating a Web API and my model has a property byte[]
, but every time I try to make a Post
my model arrives null, taking away the property byte[]
he usually arrives the model.
[Table("Pessoas")]
public class Pessoa : ITableData
{
public string Id { get; set; }
public string Nome { get; set; }
public DateTime DataNascimento { get; set; }
public byte[] Version { get; set; }
public DateTimeOffset? CreatedAt { get; set; }
public DateTimeOffset? UpdatedAt { get; set; }
public bool Deleted { get; set; }
}
the property byte[] Version
is an implementation of ITableData
.
// POST: api/Pessoas
[HttpPost]
public async Task<IActionResult> PostPessoa([FromBody] Pessoa pessoa)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
_context.Pessoas.Add(pessoa);
await _context.SaveChangesAsync();
return CreatedAtAction("GetPessoa", new { id = pessoa.Id }, pessoa);
}
The implementation of ITableData
is part of a future attempt to work with the Sdk
of Azure
to work with data synchronization in an application mobile
.
But still the question remains, how to give a Post
in a model with a type property byte[]
?
So, what I’m trying to create is a backend to work with data offline on a mobile client, now I’ve read the documentation better and found an example of Azure itself that shows better how to build this backend.
– Pablo Tondolo de Vargas