35 lines
756 B
C#
35 lines
756 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
using LiteDB;
|
|
|
|
using skydiveLogs_api.Data.Interface;
|
|
using skydiveLogs_api.Model;
|
|
|
|
|
|
namespace skydiveLogs_api.Data
|
|
{
|
|
public class AircraftRepository : IAircraftRepository
|
|
{
|
|
public AircraftRepository(IDataProvider dataProvider)
|
|
{
|
|
_dataProvider = dataProvider;
|
|
_col = _dataProvider.CollOfAircraft;
|
|
}
|
|
|
|
public IEnumerable<Aircraft> GetAll()
|
|
{
|
|
return _col.FindAll().ToList();
|
|
}
|
|
|
|
public Aircraft GetById(int id)
|
|
{
|
|
return _col.FindById(new BsonValue(id));
|
|
}
|
|
|
|
private readonly IDataProvider _dataProvider;
|
|
|
|
private readonly LiteCollection<Aircraft> _col;
|
|
}
|
|
}
|