I need to write a function that returns with a signature just like the one below.
public async Task<IEnumerable<RouteData>> GetAll()
{
return await _dbContext.RouteData.ToListAsync();
}
The above works because EntityFramework gives me RouteData which I can call the extension method ToListAsync on.
However, I am creating a list statically that I return from GetAll() that I want to return as async. I've tried Task(() => GetAll()) with no luck. Here is my method that returns correctly without async
public IEnumerable<RouteData> GetAll()
{
List <RouteData> routeDataList = GetRoutesAll();
return routeDataList;
}
My question is, what is the code that I would use to return from this:
public async Task<IEnumerable<RouteData>> GetAll()
{
return await GetRoutesAll(); // THIS DOESN'T WORK
}