What is the difference between these two calls to the database? The first one excludes the async and await keywords on the Task that is happening. But the calling code from the controller awaits it, so what is the difference and what is the correct way?:
1)
in controller:
var company = await _repository.GetAsync(Id);
in repository:
public Task<Company> GetAsync(int Id) { return _context.Companies.FirstOrDefaultAsync(i => i.Id == Id); }
2)
var company = await _repository.GetAsync(Id);
public async Task<Company> GetAsync(Id) { return await _context.Companies.FirstOrDefaultAsync(i => i.Id == Id);
}