如何使用rest httppost填充对象? [英] How can i populate an object using rest httppost?

查看:109
本文介绍了如何使用rest httppost填充对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个:

[路线(&api / [controller]")]

public class OptoutClientController:Controller

{

HttpClient client = new HttpClient();

[HttpPost]
$
public IActionResult取消订阅([FromBody] OptOutCliente cliente)

{

返回Ok();

}



}

我的模特类

公共类OptOutCliente

{

public Int64 Cpf {get;组; }

public String Email {get;组; }
$
public String Telefone {get;组; }

public String Bandeira {get;组; }

public String Canal {get;组; }

}

Url Postman:  http:// localhost:55522 / api / optoutclient

Url Postman: http://localhost:55522/api/optoutclient

Json Postman: 

Json Postman: 

{

" Cpf":" 128907",

" Email":" p@p.com.br"

" Telefone":"971418418",

" Bandeira":"CB",

" Canal":" EML"

}

进入Controller的var cliente是Null。为什么?

In the var cliente into Controller is Null. Why?

推荐答案

显示邮递员配置,这可能是你的控制器,模型和json看起来很好的问题。
Show your postman config, that is likely where the issue is as your controller, model and json looks fine.


这篇关于如何使用rest httppost填充对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆