我有一个带有一些测试功能的.net Core 2 API设置.(Visual Studio 2017)
使用postman我用一个原始数据发布到该方法的帖子,但模型只是空白?为什么?
// POST api/Product/test
[HttpPost]
[Route("test")]
public object test(MyTestModel model)
{
try
{
var a = model.SomeTestParam;
return Ok("Yey");
}
catch (Exception ex)
{
return BadRequest(new { message = ex.Message });
}
}
public class MyTestModel
{
public int SomeTestParam { get; set; }
}
Run Code Online (Sandbox Code Playgroud)