Add a cache system on the referential info
+ Add an identity service
This commit is contained in:
@@ -1,37 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using LiteDB;
|
||||
|
||||
using LiteDB;
|
||||
using skydiveLogs_api.Domain;
|
||||
using skydiveLogs_api.DomainService.Repositories;
|
||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Infrastructure
|
||||
{
|
||||
public class JumpRepository : IJumpRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public JumpRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfJump;
|
||||
}
|
||||
|
||||
public IEnumerable<Jump> GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.Aircraft)
|
||||
.Include(x => x.DropZone)
|
||||
.Include(x => x.Gear)
|
||||
.Include(x => x.JumpType)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.ToList();
|
||||
}
|
||||
#endregion Public Constructors
|
||||
|
||||
public Jump GetById(int id)
|
||||
{
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
#region Public Methods
|
||||
|
||||
public int Add(Jump newJump)
|
||||
{
|
||||
@@ -50,9 +37,15 @@ namespace skydiveLogs_api.Infrastructure
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool Update(Jump updatedJump)
|
||||
public IEnumerable<Jump> GetAll(User user)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
return _col.Include(x => x.Aircraft)
|
||||
.Include(x => x.DropZone)
|
||||
.Include(x => x.Gear)
|
||||
.Include(x => x.JumpType)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Jump> GetAll()
|
||||
@@ -60,8 +53,23 @@ namespace skydiveLogs_api.Infrastructure
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private readonly IDataProvider _dataProvider;
|
||||
public Jump GetById(int id)
|
||||
{
|
||||
return _col.FindById(new BsonValue(id));
|
||||
}
|
||||
|
||||
public bool Update(Jump updatedJump)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<Jump> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user