In order to visualize the data, we need to write some code so that it can be read from the database. Let's set this up:
- In the MeTracker project, open the ILocationRepository.cs file.
- Add a GetAll method, which returns a list of Location objects, using the following code:
Task<List<Location>> GetAll() ;
- In the MeTracker project, open the LocationRepository.cs file, which implements ILocationRepository.
- Implement the new GetAll method and return all the saved locations in the database, as shown in the following code:
public async Task<List<Location>> GetAll()
{
await CreateConnection();
var locations = await connection.Table<Location>
().ToListAsync();
return locations;
}