is that I have a PUT and I want to capture the value of the field that I am going to update, but in the database in SQL_Variant
, so to do it I have to send an object when sending it to the database , this is my PUT
[HttpPut("{empid}/{codigo}/{valor}")]
public async Task<IActionResult> Put(int empid, string codigo, [FromRoute]object valor)
{
try
{
return Ok(await repository.UpdateAsync(empid, codigo, valor));
}
catch (Exception e)
{
return BadRequest(e.ToString());
}
}
If I here [FromRoute]object valor
change it to string or int it receives it correctly, but if I leave it in type Object
Null will arrive and it does not help me, how do I capture an object from the Controller route? ?