C# 向web api发送与模型不匹配的JSON是可行的,我不希望这样

C# 向web api发送与模型不匹配的JSON是可行的,我不希望这样,c#,json,asp.net-mvc,asp.net-web-api,C#,Json,Asp.net Mvc,Asp.net Web Api,我有一些问题。当我发送与我的类型模型不匹配的JSON数据时,我不想实例化对象。我知道发生这种情况的原因是因为我有一个无参数构造函数 public TypeVm() { Id = Id; Registration = Registration; Card = Card; TypeId = TypeId; OwnerId = OwnerId; Stamp = Stamp; } public IHttpActionResult Post(TypeVm

我有一些问题。当我发送与我的类型模型不匹配的JSON数据时,我不想实例化对象。我知道发生这种情况的原因是因为我有一个无参数构造函数

public TypeVm()
{
    Id = Id;
    Registration = Registration;
    Card = Card;
    TypeId = TypeId;
    OwnerId = OwnerId;
    Stamp = Stamp;
}

public IHttpActionResult Post(TypeVm type)
{
    return type== null ? BadRequest() : _typeRegisterService.AddTypeRegistration(type) > 0 ? (IHttpActionResult)Ok() : BadRequest();
}
如果提供的JSON数据与模型不匹配,我只希望对象为null(如果我没有无参数构造函数,它将变为null)。问题是我需要无参数构造函数,因为我有模型的其他构造函数

有谁能指导我如何解决这个问题