Percebo que o FromBody está vindo null e não sei porque.
Esse é o meu payload no Postman
{
"ChannelCode" : "TS",
"Name" : "Teste",
"Celphone" : "(11)999999999",
"Endpoint" : "www.teste.com.br",
"TokenLogin" : "1234567890",
"TokenLoginExpiration" : "2018-06-13T00:00:00.000Z",
"Active" : "true"
}
Nessa controller eu recebo a request
[HttpPost]
[Authorize("Bearer")]
public async Task<IActionResult> Create([FromBody]ChannelCreateRequest channel)
{
if (channel == null) throw new WhatsAppApiException("Favor informar os dados do Canal!");
var result = await _channelCreateService.Process(new ChannelCreateCommand(channel.ChannelCode, channel.Name,
channel.Celphone, channel.Endpoint,
channel.TokenLogin,
channel.TokenLoginExpiration ,
channel.Active.GetValueOrDefault(true)));
return Ok(new ApiReturnItem<ChannelResult> { Item = result, Success = true });
}
tudo será gravado no MongoDB
Classe ChannelCreateRequest
public class ChannelCreateRequest
{
[JsonProperty("codigo_canal")]
public string ChannelCode { get; set; }
[JsonProperty("nome")]
public string Name { get; set; }
[JsonProperty("celular")]
public string Celphone { get; set; }
[JsonProperty("url")]
public string Endpoint { get; set; }
//------ Remover-----------
[JsonProperty("token_canal")]
public string TokenLogin { get; set; }
[JsonProperty("token_canal_expiracao")]
public DateTime? TokenLoginExpiration { get; set; }
//--------Fim remover---------
[JsonProperty("ativo")]
public Boolean? Active { get; set; }
}
respondendo ao Pagotti, eis o postman