I'm creating a Web API and my model has a byte[]
property, however whenever I try to Post
my model arrives null, taking the byte[]
property it normally arrives at 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; }
}
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 Sdk
Azure
to work with data synchronization in a mobile
application.
But still the question is, how do you give a Post
in a model with a property of type byte[]
?