I have a problem with Post a complex model object from client to Web Api controller. My Model structure is:
public class PaymentModel
{
public Credit Crediter { get; set; }
}
public class Credit : ICredit
{
public int BankInformationId { get; set; }
}
public interface ICredit
{
int BankInformationId { get; set; }
}
public sealed class CrediterEmployee:Credit
{
public int EnployeeId { get; set; }
}
I tried to create a model to post to API controller:
var param=new PaymentModel
{
Crediter = new CrediterEmployee
{
BankInformationId = 4928,
EnployeeId = 7013
},
}
In API controller i received a model object, but for Crediter i cannot cast to CreditEmployee. It is null when i tried to cast.
How can i cast Crediter to the CreditEmployee?
Aucun commentaire:
Enregistrer un commentaire