41 lines
896 B
C#
41 lines
896 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 DropZoneRepository : IDropZoneRepository
|
|
{
|
|
public DropZoneRepository(IDataProvider dataProvider)
|
|
{
|
|
_dataProvider = dataProvider;
|
|
_col = _dataProvider.CollOfDropZone;
|
|
}
|
|
|
|
public IEnumerable<DropZone> GetAll()
|
|
{
|
|
var results = _col.FindAll().ToList();
|
|
_dataProvider.Close();
|
|
|
|
return results;
|
|
}
|
|
|
|
public DropZone GetById(int id)
|
|
{
|
|
var result = _col.FindById(new BsonValue(id));
|
|
_dataProvider.Close();
|
|
|
|
return result;
|
|
}
|
|
|
|
private readonly IDataProvider _dataProvider;
|
|
|
|
private readonly LiteCollection<DropZone> _col;
|
|
}
|
|
}
|