Add a link betweend a gear to the connected user.
This commit is contained in:
@@ -19,7 +19,15 @@ namespace skydiveLogs_api.Data
|
||||
|
||||
public IEnumerable<Gear> GetAll()
|
||||
{
|
||||
return _col.FindAll().ToList();
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Gear> GetAll(User connectedUser)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
ToList();
|
||||
}
|
||||
|
||||
public Gear GetById(int id)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using skydiveLogs_api.Model;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Data.Interface
|
||||
{
|
||||
public interface IGearRepository : IRepository<Gear>
|
||||
{
|
||||
IEnumerable<Gear> GetAll(User connectedUser);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,5 @@ namespace skydiveLogs_api.Data.Interface
|
||||
public interface IJumpRepository : IRepository<Jump>
|
||||
{
|
||||
IEnumerable<Jump> GetAll(User user);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace skydiveLogs_api.Data
|
||||
public LiteDbProvider(string connectionString)
|
||||
{
|
||||
_db = new LiteDatabase(connectionString);
|
||||
|
||||
BsonMapper.Global.Entity<Jump>().DbRef(x => x.JumpType, "JumpType");
|
||||
BsonMapper.Global.Entity<Jump>().DbRef(x => x.Aircraft, "Aircraft");
|
||||
BsonMapper.Global.Entity<Jump>().DbRef(x => x.DropZone, "DropZone");
|
||||
@@ -17,6 +18,8 @@ namespace skydiveLogs_api.Data
|
||||
BsonMapper.Global.Entity<Jump>().DbRef(x => x.User, "User");
|
||||
|
||||
BsonMapper.Global.Entity<UserImage>().DbRef(x => x.User, "User");
|
||||
|
||||
BsonMapper.Global.Entity<Gear>().DbRef(x => x.User, "User");
|
||||
}
|
||||
|
||||
public ILiteCollection<T> GetCollection<T>()
|
||||
|
||||
Reference in New Issue
Block a user