I have a case where the JavaScript client side model does not match with the WebAPI model. In the following code, the status on the client side is a string while the same in the WebAPI is an integer.
How can I achieve the mapping of status from string to an integer without adding an if statement in the Post method and without modifying the Order model?
$.post('/Shipping/UpdateStatus', { orderId: 1000, status: "Accepted"} )
void Post([FromBody] Order order)
{
}
class Order
{
int OderId { get; set; }
int ShippingStatus { get; set; };
}