Model
namespace VSProjects.Models
{
public class QueryRequest
{
public string id;
public string name;
public string duty;
public string date1;
public string date2;
}
public class QueryResponse
{
public string id;
public string name;
public string duty;
public string date1;
public string date2;
public string time;
}
}
WeatherForecastController
using System;
using Microsoft.AspNetCore.Mvc;
using VSProjects.Models;
namespace VSProjects.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
//POST: api/weatherforecast
[HttpPost]
public QueryResponse Post([FromBody] QueryRequest req)
{
QueryResponse resp = new QueryResponse();
try
{
}
catch (Exception e)
{
Console.WriteLine(e);
}
return resp;
}
}
}
我在try里面打了断点,postman测试接口可以进入断点,但是req拿到的数据都是null,为什么呢?