I want my client to be able to sent some data of the model to the web via Restful request. How can I know if not all part of the object is sent?
For example, the request sent only id, datetime_updated but not qty and datetime_updated.
I know that the framework will set the value to the default of its type, so I can check if DateTime wasn't sent (the default value is 1/1/0001 12:00:00AM which have no meaning in my application). But what about int, I can't simply check that if the value is 0 (0 has it meaning).
// Model
namespace TestingAPI.Models
{
public class Operator
{
public int pkey { get; set; }
public string id { get; set; }
public int qty {get; set;}
public DateTime datetime_created { get; set; }
public DateTime datetime_updated { get; set; }
}
}
// Controller
namespace TestingApi.Controllers
{
public class ProcessingPalletController : ApiController
{
public Dictionary<string, object> post(Product dataIn)
{
// how can I know if not all argument in Product is sent?
}
}
}