我想使用 filterType 参数来定义 Stock 对象上要过滤的属性。
[HttpGet("{searchText}/{filterType}")]
public async Task<ActionResult<List<Stock>>> Get(string searchText, string filterType)
{
List<Stock> v = await this._context.StockView.Where(w => w.[filterType] == searchText).ToListAsync();
return this.Ok(v);
}
有没有办法做到这一点,我可以使用字符串参数来定义要限制的对象的属性?
慕姐8265434
12345678_0001
相关分类