System.Threading.Tasks.Task OnGetAsync(), Void OnGet()
I receive this error when building an application for .NET Core 2.1 in Microsoft Visual Studio 2017. This is the view I believe has the error within it. It is for the main index.cshtml razor page.
public class IndexModel : PageModel
{
private readonly AppDbContext _db;
public IndexModel(AppDbContext db)
{
_db = db;
}
public IList<Customer> Customers { get; private set; }
public async Task OnGetAsync()
{
Customers = await _db.Customers.AsNoTracking().ToListAsync();
}
public async Task<IActionResult> OnPostDeleteAsync(int id)
{
var contact = await _db.Customers.FindAsync(id);
if (contact != null)
{
_db.Customers.Remove(contact);
await _db.SaveChangesAsync();
}
return RedirectToPage();
}
public void OnGet()
{
}
}