我有一张符合自然规律的桌子。
+----+-----------+-----------+------+---------+------+
| 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
由于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 Respone AS,
[
"60", "61"
]
但我得到以下错误。
我做错了什么?