I have class object call CustomerBase.cs with certain properties. It acts as base class for two of my other classes : Customer.cs and Vendor.cs . i.e
public class Customer: CustomerBase
public class Vendor: CustomerBase
I have a controller method as follows:
[HttpPost("CustomerData")]
public async Task<CustomerBase> CustomerDataAsync(CustomerBase customerBaseParam)
{ }
When this api controller is called by another web user , the Json body parameter will contain the $Type of the rootobject. It can contain vendor or Customer or just the CustomerBase. For now even when I am passing Vendor object as parameter, it is only keeping the customerBase properties for the customerBaseParam. Same with Customer object sent as Parameter. How can I change the type of customerBaseParam based on the Json body parameter that is coming in.?
Am using Newtonsoft.