Now that we have created a model, we can start creating the repository. First, we will create an interface for the repository. Follow these steps to do so:
- In the MeTracker project, create a new folder called Repositories.
- In our new folder, create an interface called ILocationRepository.
- Write the following code in the new file that we created for the interface:
using MeTracker.Models;
using System;
using System.Threading.Tasks;
namespace MeTracker.Repositories
{
public interface ILocationRepository
{
Task Save(Location location);
}
}
- Add a using directive for MeTracker.Models and System.Threading.Tasks to resolve the references for Location and Task.
Now that we have an interface, we need to create an implementation of it. Follow these steps to do so:
- In the MeTracker project, create a new class called LocationRepository.
- Implement the ILocationRepository interface and add the async keyword to the Save...