我有一张以下性质的表格。
+----+-----------+-----------+------+---------+------+
| Id | AccountId | ProjectId | Year | Quarter | Data |
+----+-----------+-----------+------+---------+------+
| 39 | 163 | 60 | 2019 | 2 | 0 |
| 40 | 163 | 60 | 2019 | 2 | 8 |
| 41 | 163 | 61 | 2019 | 2 | 1 |
| 42 | 163 | 61 | 2019 | 2 | 2 |
+----+-----------+-----------+------+---------+------+
我想ProjectIds使用 Entity Framework 与 Json 不同,到目前为止我的代码看起来像这样。
// GET: api/Insight/163/2019/2
[HttpGet("{accid}/{year}/{qurter}")]
public async Task<IActionResult> GetSurveys([FromRoute] long accid, [FromRoute] long year, [FromRoute] long qurter)
{
//This code gives me the error.
return await _context.CustomerSatisfactionResults.Select(x=>x.ProjectId)
.Where(x => x.AccountId == accid && x.Year == year && x.Quarter == qurter).ToListAsync();
}
当我用参数点击这个端点时,/163/2019/2我想要一个 Json 响应,
[
"60", "61"
]
但我收到以下错误。
我做错了什么?
慕姐8265434
相关分类