Add dependency Injection
This commit is contained in:
11
Repositories/IGerbilRepository.cs
Normal file
11
Repositories/IGerbilRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using GerbilManager.Models;
|
||||
|
||||
namespace GerbilManager.Repositories
|
||||
{
|
||||
public interface IGerbilRepository
|
||||
{
|
||||
IEnumerable<Gerbil> GetGerbils();
|
||||
|
||||
Gerbil GetGerbil(Guid id);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,7 @@ using GerbilManager.Models;
|
||||
|
||||
namespace GerbilManager.Repositories
|
||||
{
|
||||
|
||||
public class InMemGerbilRepository
|
||||
public class InMemGerbilRepository : IGerbilRepository
|
||||
{
|
||||
private readonly List<Gerbil> _gerbilList = new()
|
||||
{
|
||||
@@ -19,5 +18,5 @@ namespace GerbilManager.Repositories
|
||||
|
||||
public Gerbil GetGerbil(Guid id) => _gerbilList.SingleOrDefault(x => x.Id == id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user