我将如何删除自己设置的参数,例如
ID-已创建-根据我的模型创建的CreatedBy,并且示例招摇将在UI中显示
ServicePoint模型以这种方式显示。当我按尝试此示例时,如何使其仅显示名称,数字等?没有使其成为简单的参数?是制作DTO模型的唯一选择还是?
{
"name": "string",
"number": 0,
"timeStamp": "string",
"createdDate": "2019-06-28T11:11:12.656Z",
"createdBy": "string",
"modifiedDate": "2019-06-28T11:11:12.656Z",
"modifiedBy": "string",
"id": 0
}
我的Post方法。
/// <summary>
/// Creates a ServicePoint.
/// </summary>
/// <response code="201">Returns the newly created ServicePoint</response>
/// <response code="400">If the item is null</response>
[HttpPost]
[ProducesResponseType(201)]
[ProducesResponseType(400)]
public async Task<IActionResult> PostServicePoint([FromBody] ServicePoint servicePoint)
{
_context.ServicePoint.Add(servicePoint);
await _context.SaveChangesAsync();
return CreatedAtAction("GetServicePoint", new { id = servicePoint.Id }, servicePoint);
}