Update about the relation column "User" for the images
and begin to add a column in "Aircraft"
This commit is contained in:
@@ -39,7 +39,7 @@ namespace skydiveLogs_api.Business
|
|||||||
jump.JumpType = selectedJumpType;
|
jump.JumpType = selectedJumpType;
|
||||||
jump.DropZone = selectedDropZone;
|
jump.DropZone = selectedDropZone;
|
||||||
jump.Gear = selectedGear;
|
jump.Gear = selectedGear;
|
||||||
jump.UserId = connectedUser.Id;
|
jump.User = connectedUser;
|
||||||
|
|
||||||
_jumpRepository.Add(jump);
|
_jumpRepository.Add(jump);
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ namespace skydiveLogs_api.Business
|
|||||||
|
|
||||||
public IEnumerable<Jump> GetAllJumps(User connectedUser)
|
public IEnumerable<Jump> GetAllJumps(User connectedUser)
|
||||||
{
|
{
|
||||||
return _jumpRepository.GetAll(connectedUser.Id);
|
return _jumpRepository.GetAll(connectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Jump GetJumpById(int id)
|
public Jump GetJumpById(int id)
|
||||||
|
|||||||
@@ -19,7 +19,15 @@ namespace skydiveLogs_api.Data
|
|||||||
|
|
||||||
public IEnumerable<Image> GetAll()
|
public IEnumerable<Image> GetAll()
|
||||||
{
|
{
|
||||||
return _col.FindAll().ToList();
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Image> GetAll(User user)
|
||||||
|
{
|
||||||
|
return _col.Include(x => x.User)
|
||||||
|
.Query()
|
||||||
|
.Where(j => j.User == user)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image GetById(int id)
|
public Image GetById(int id)
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using skydiveLogs_api.Model;
|
using System.Collections.Generic;
|
||||||
|
using skydiveLogs_api.Model;
|
||||||
|
|
||||||
|
|
||||||
namespace skydiveLogs_api.Data.Interface
|
namespace skydiveLogs_api.Data.Interface
|
||||||
{
|
{
|
||||||
public interface IImageRepository : IRepository<Image>
|
public interface IImageRepository : IRepository<Image>
|
||||||
{
|
{
|
||||||
|
IEnumerable<Image> GetAll(User user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace skydiveLogs_api.Data.Interface
|
|||||||
{
|
{
|
||||||
public interface IJumpRepository : IRepository<Jump>
|
public interface IJumpRepository : IRepository<Jump>
|
||||||
{
|
{
|
||||||
IEnumerable<Jump> GetAll(int userId);
|
IEnumerable<Jump> GetAll(User user);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using LiteDB;
|
using LiteDB;
|
||||||
|
|
||||||
@@ -17,14 +16,15 @@ namespace skydiveLogs_api.Data
|
|||||||
_col = _dataProvider.CollOfJump;
|
_col = _dataProvider.CollOfJump;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Jump> GetAll(int userId)
|
public IEnumerable<Jump> GetAll(User user)
|
||||||
{
|
{
|
||||||
return _col.Include(x => x.Aircraft)
|
return _col.Include(x => x.Aircraft)
|
||||||
.Include(x => x.DropZone)
|
.Include(x => x.DropZone)
|
||||||
.Include(x => x.Gear)
|
.Include(x => x.Gear)
|
||||||
.Include(x => x.JumpType)
|
.Include(x => x.JumpType)
|
||||||
.FindAll()
|
.Include(x => x.User)
|
||||||
.Where(j => j.UserId == userId)
|
.Query()
|
||||||
|
.Where(j => j.User == user)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace skydiveLogs_api.Data
|
|||||||
BsonMapper.Global.Entity<Jump>().DbRef(x => x.Aircraft, "Aircraft");
|
BsonMapper.Global.Entity<Jump>().DbRef(x => x.Aircraft, "Aircraft");
|
||||||
BsonMapper.Global.Entity<Jump>().DbRef(x => x.DropZone, "DropZone");
|
BsonMapper.Global.Entity<Jump>().DbRef(x => x.DropZone, "DropZone");
|
||||||
BsonMapper.Global.Entity<Jump>().DbRef(x => x.Gear, "Gear");
|
BsonMapper.Global.Entity<Jump>().DbRef(x => x.Gear, "Gear");
|
||||||
|
BsonMapper.Global.Entity<Jump>().DbRef(x => x.User, "User");
|
||||||
|
|
||||||
BsonMapper.Global.Entity<Image>().DbRef(x => x.User, "User");
|
BsonMapper.Global.Entity<Image>().DbRef(x => x.User, "User");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,7 @@
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string ImageData { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace skydiveLogs_api.Model
|
|||||||
|
|
||||||
public Gear Gear { get; set; }
|
public Gear Gear { get; set; }
|
||||||
|
|
||||||
public int UserId { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
public int ExitAltitude { get; set; }
|
public int ExitAltitude { get; set; }
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -5,5 +5,7 @@
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string ImageData { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,7 @@
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string ImageData { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user