我是 .NET Core 的新手,我正在阅读此文档https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-2.1
从那里我正在练习 - 我写下这个逻辑:
public async Task<ActionResult<List<DashBoar>>> GetAllAsync()
{
var x = _Repo.GetPetsAsync();
return await x.ToList();
}
Run Code Online (Sandbox Code Playgroud)
但我收到错误。
我的回购课程是
public IEnumerable<DashBoar> GetPetsAsync()
{
var x = from n in _context.DashBoar
select n;
return x.ToList();
}
Run Code Online (Sandbox Code Playgroud)