I am trying to get a list of entries from database. But I am getting an error.
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<models.DbModels.GrantProgram>' to 'Microsoft.AspNetCore.Mvc.ActionResult<System.Collections.Generic.IEnumerable<models.DbModels.GrantProgram>>' [API]
Please help me. How can I solve this?
Controller.cs
public async Task<ActionResult<IEnumerable<GrantProgram>>> GetGrants()
{
//This is where the error is showing.
return await _grants.GetGrants();
}
Business layer
IGrants.cs
Task<IEnumerable<GrantProgram>> GetGrants();
Grants.cs
public async Task<IEnumerable<GrantProgram>> GetGrants()
{
return await _grantRepository.GetGrants();
}
Data access layer
IGrantsRepository.cs
Task<IEnumerable<GrantProgram>> GetGrants();
GrantsRepository.cs
public async Task<IEnumerable<GrantProgram>> GetGrants()
{
return await _context.GrantProgram.ToListAsync();
}