Add repos + repo interfaces + models + ioc
This commit is contained in:
17
Back/skydiveLogs-api.Domain/StatsByAircraft.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsByAircraft.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsByAircraft
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsByDz.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsByDz.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsByDz
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsByGear.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsByGear.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsByGear
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsByJumpType.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsByJumpType.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsByJumpType
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsByYear.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsByYear.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsByYear
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsByYearByJumpType.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsByYearByJumpType.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsByYearByJumpType
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsForLastMonthByDz.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsForLastMonthByDz.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsForLastMonthByDz
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsForLastMonthByJumpType.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsForLastMonthByJumpType.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsForLastMonthByJumpType
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsForLastYearByDz.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsForLastYearByDz.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsForLastYearByDz
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
17
Back/skydiveLogs-api.Domain/StatsForLastYearByJumpType.cs
Normal file
17
Back/skydiveLogs-api.Domain/StatsForLastYearByJumpType.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Domain
|
||||
{
|
||||
public class StatsForLastYearByJumpType
|
||||
{
|
||||
public string Label { get; set; }
|
||||
|
||||
public string Label2 { get; set; }
|
||||
|
||||
public int Nb { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public User User { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsByDzRepository : IRepository<StatsByDz>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsByDz GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsByGearRepository : IRepository<StatsByGear>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsByGear GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsByJumpTypeRepository : IRepository<StatsByJumpType>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsByJumpType GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsByYearByJumpTypeRepository : IRepository<StatsByYearByJumpType>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsByYearByJumpType GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsByYearRepository : IRepository<StatsByYear>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsByYear GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsForLastMonthByDzRepository : IRepository<StatsForLastMonthByDz>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsForLastMonthByDz GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsForLastMonthByJumpTypeRepository : IRepository<StatsForLastMonthByJumpType>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsForLastMonthByJumpType GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsForLastYearByDzRepository : IRepository<StatsForLastYearByDz>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsForLastYearByDz GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using skydiveLogs_api.Domain;
|
||||
|
||||
namespace skydiveLogs_api.DomainService.Repositories
|
||||
{
|
||||
public interface IStatsForLastYearByJumpTypeRepository : IRepository<StatsForLastYearByJumpType>
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
StatsForLastYearByJumpType GetAll(User user);
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -30,12 +30,30 @@ namespace skydiveLogs_api.Infrastructure.Interfaces
|
||||
|
||||
ILiteCollection<JumpType> CollOfJumpType { get; }
|
||||
|
||||
ILiteCollection<UserStats> CollOfStats { get; }
|
||||
|
||||
ILiteCollection<User> CollOfUser { get; }
|
||||
|
||||
|
||||
ILiteCollection<TunnelFlight> CollOfTunnelFlight { get; }
|
||||
|
||||
ILiteCollection<StatsByAircraft> CollOfStatsByAircraft { get; }
|
||||
|
||||
ILiteCollection<StatsByDz> CollOfStatsByDz { get; }
|
||||
|
||||
ILiteCollection<StatsByGear> CollOfStatsByGear { get; }
|
||||
|
||||
ILiteCollection<StatsByJumpType> CollOfStatsByJumpType { get; }
|
||||
|
||||
ILiteCollection<StatsByYear> CollOfStatsByYear { get; }
|
||||
|
||||
ILiteCollection<StatsForLastMonthByDz> CollOfStatsForLastMonthByDz { get; }
|
||||
|
||||
ILiteCollection<StatsForLastMonthByJumpType> CollOfStatsForLastMonthByJumpType { get; }
|
||||
|
||||
ILiteCollection<StatsForLastYearByDz> CollOfStatsForLastYearByDz { get; }
|
||||
|
||||
ILiteCollection<StatsForLastYearByJumpType> CollOfStatsForLastYearByJumpType { get; }
|
||||
|
||||
ILiteCollection<StatsByYearByJumpType> CollOfStatsByYearByJumpType { get; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,6 @@ namespace skydiveLogs_api.Infrastructure
|
||||
|
||||
BsonMapper.Global.Entity<UserImage>().DbRef(x => x.User, "User");
|
||||
|
||||
BsonMapper.Global.Entity<UserStats>().DbRef(x => x.User, "User");
|
||||
|
||||
BsonMapper.Global.Entity<Gear>().DbRef(x => x.User, "User");
|
||||
|
||||
BsonMapper.Global.Entity<FavoriteDropZone>().DbRef(x => x.User, "User");
|
||||
@@ -31,6 +29,17 @@ namespace skydiveLogs_api.Infrastructure
|
||||
BsonMapper.Global.Entity<TunnelFlight>().DbRef(x => x.Tunnel, "DropZone");
|
||||
BsonMapper.Global.Entity<TunnelFlight>().DbRef(x => x.JumpType, "JumpType");
|
||||
BsonMapper.Global.Entity<TunnelFlight>().DbRef(x => x.User, "User");
|
||||
|
||||
BsonMapper.Global.Entity<StatsByAircraft>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsByDz>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsByGear>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsByJumpType>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsByYear>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsForLastMonthByDz>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsForLastMonthByJumpType>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsForLastYearByDz>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsForLastYearByJumpType>().DbRef(x => x.User, "User");
|
||||
BsonMapper.Global.Entity<StatsByYearByJumpType>().DbRef(x => x.User, "User");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -58,10 +67,18 @@ namespace skydiveLogs_api.Infrastructure
|
||||
public ILiteCollection<UserImage> CollOfImage => _db.GetCollection<UserImage>();
|
||||
public ILiteCollection<Jump> CollOfJump => _db.GetCollection<Jump>();
|
||||
public ILiteCollection<JumpType> CollOfJumpType => _db.GetCollection<JumpType>();
|
||||
public ILiteCollection<UserStats> CollOfStats => _db.GetCollection<UserStats>();
|
||||
public ILiteCollection<User> CollOfUser => _db.GetCollection<User>();
|
||||
public ILiteCollection<TunnelFlight> CollOfTunnelFlight => _db.GetCollection<TunnelFlight>();
|
||||
|
||||
public ILiteCollection<StatsByAircraft> CollOfStatsByAircraft => _db.GetCollection<StatsByAircraft>();
|
||||
public ILiteCollection<StatsByDz> CollOfStatsByDz => _db.GetCollection<StatsByDz>();
|
||||
public ILiteCollection<StatsByGear> CollOfStatsByGear => _db.GetCollection<StatsByGear>();
|
||||
public ILiteCollection<StatsByJumpType> CollOfStatsByJumpType => _db.GetCollection<StatsByJumpType>();
|
||||
public ILiteCollection<StatsByYear> CollOfStatsByYear => _db.GetCollection<StatsByYear>();
|
||||
public ILiteCollection<StatsForLastMonthByDz> CollOfStatsForLastMonthByDz => _db.GetCollection<StatsForLastMonthByDz>();
|
||||
public ILiteCollection<StatsForLastMonthByJumpType> CollOfStatsForLastMonthByJumpType => _db.GetCollection<StatsForLastMonthByJumpType>();
|
||||
public ILiteCollection<StatsForLastYearByDz> CollOfStatsForLastYearByDz => _db.GetCollection<StatsForLastYearByDz>();
|
||||
public ILiteCollection<StatsForLastYearByJumpType> CollOfStatsForLastYearByJumpType => _db.GetCollection<StatsForLastYearByJumpType>();
|
||||
public ILiteCollection<StatsByYearByJumpType> CollOfStatsByYearByJumpType => _db.GetCollection<StatsByYearByJumpType>();
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using LiteDB;
|
||||
using LiteDB;
|
||||
using skydiveLogs_api.Domain;
|
||||
using skydiveLogs_api.DomainService.Repositories;
|
||||
using skydiveLogs_api.Infrastructure.Interfaces;
|
||||
@@ -6,21 +6,21 @@ using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.Infrastructure
|
||||
{
|
||||
public class UserStatsRepository : IUserStatsRepository
|
||||
public class StatsByDzRepository : IStatsByDzRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public UserStatsRepository(IDataProvider dataProvider)
|
||||
public StatsByDzRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStats;
|
||||
_col = _dataProvider.CollOfStatsByDz;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(UserStats newStats)
|
||||
public int Add(StatsByDz newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace skydiveLogs_api.Infrastructure
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<UserStats> GetAll()
|
||||
public IEnumerable<StatsByDz> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public UserStats GetAll(User user)
|
||||
public StatsByDz GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
@@ -50,7 +50,7 @@ namespace skydiveLogs_api.Infrastructure
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public UserStats GetById(int id)
|
||||
public StatsByDz GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace skydiveLogs_api.Infrastructure
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(UserStats stats)
|
||||
public bool Update(StatsByDz stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ namespace skydiveLogs_api.Infrastructure
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<UserStats> _col;
|
||||
private readonly ILiteCollection<StatsByDz> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
77
Back/skydiveLogs-api.Infrastructure/StatsByGearRepository.cs
Normal file
77
Back/skydiveLogs-api.Infrastructure/StatsByGearRepository.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
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 StatsByGearRepository : IStatsByGearRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsByGearRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStatsByGear;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(StatsByGear newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
try
|
||||
{
|
||||
var tmp = _col.Insert(newStats);
|
||||
result = tmp.AsInt32;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<StatsByGear> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public StatsByGear GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public StatsByGear GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(StatsByGear stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<StatsByGear> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
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 StatsByJumpTypeRepository : IStatsByJumpTypeRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsByJumpTypeRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStatsByJumpType;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(StatsByJumpType newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
try
|
||||
{
|
||||
var tmp = _col.Insert(newStats);
|
||||
result = tmp.AsInt32;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<StatsByJumpType> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public StatsByJumpType GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public StatsByJumpType GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(StatsByJumpType stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<StatsByJumpType> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
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 StatsByYearByJumpTypeRepository : IStatsByYearByJumpTypeRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsByYearByJumpTypeRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStatsByYearByJumpType;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(StatsByYearByJumpType newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
try
|
||||
{
|
||||
var tmp = _col.Insert(newStats);
|
||||
result = tmp.AsInt32;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<StatsByYearByJumpType> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public StatsByYearByJumpType GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public StatsByYearByJumpType GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(StatsByYearByJumpType stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<StatsByYearByJumpType> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
77
Back/skydiveLogs-api.Infrastructure/StatsByYearRepository.cs
Normal file
77
Back/skydiveLogs-api.Infrastructure/StatsByYearRepository.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
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 StatsByYearRepository : IStatsByYearRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsByYearRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStatsByYear;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(StatsByYear newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
try
|
||||
{
|
||||
var tmp = _col.Insert(newStats);
|
||||
result = tmp.AsInt32;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<StatsByYear> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public StatsByYear GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public StatsByYear GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(StatsByYear stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<StatsByYear> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
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 StatsForLastMonthByDzRepository : IStatsForLastMonthByDzRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsForLastMonthByDzRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStatsForLastMonthByDz;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(StatsForLastMonthByDz newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
try
|
||||
{
|
||||
var tmp = _col.Insert(newStats);
|
||||
result = tmp.AsInt32;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<StatsForLastMonthByDz> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public StatsForLastMonthByDz GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public StatsForLastMonthByDz GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(StatsForLastMonthByDz stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<StatsForLastMonthByDz> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
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 StatsForLastMonthByJumpTypeRepository : IStatsForLastMonthByJumpTypeRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsForLastMonthByJumpTypeRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStatsForLastMonthByJumpType;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(StatsForLastMonthByJumpType newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
try
|
||||
{
|
||||
var tmp = _col.Insert(newStats);
|
||||
result = tmp.AsInt32;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<StatsForLastMonthByJumpType> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public StatsForLastMonthByJumpType GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public StatsForLastMonthByJumpType GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(StatsForLastMonthByJumpType stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<StatsForLastMonthByJumpType> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
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 StatsForLastYearByDzRepository : IStatsForLastYearByDzRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsForLastYearByDzRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStatsForLastYearByDz;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(StatsForLastYearByDz newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
try
|
||||
{
|
||||
var tmp = _col.Insert(newStats);
|
||||
result = tmp.AsInt32;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<StatsForLastYearByDz> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public StatsForLastYearByDz GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public StatsForLastYearByDz GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(StatsForLastYearByDz stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<StatsForLastYearByDz> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
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 StatsForLastYearByJumpTypeRepository : IStatsForLastYearByJumpTypeRepository
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public StatsForLastYearByJumpTypeRepository(IDataProvider dataProvider)
|
||||
{
|
||||
_dataProvider = dataProvider;
|
||||
_col = _dataProvider.CollOfStatsForLastYearByJumpType;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public int Add(StatsForLastYearByJumpType newStats)
|
||||
{
|
||||
int result;
|
||||
|
||||
try
|
||||
{
|
||||
var tmp = _col.Insert(newStats);
|
||||
result = tmp.AsInt32;
|
||||
}
|
||||
catch
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IEnumerable<StatsForLastYearByJumpType> GetAll()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public StatsForLastYearByJumpType GetAll(User user)
|
||||
{
|
||||
return _col.Include(x => x.User)
|
||||
.Query()
|
||||
.Where(j => j.User.Id == user.Id)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public StatsForLastYearByJumpType GetById(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCount()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(StatsForLastYearByJumpType stats)
|
||||
{
|
||||
return _col.Update(stats);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILiteCollection<StatsForLastYearByJumpType> _col;
|
||||
private readonly IDataProvider _dataProvider;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -52,9 +52,18 @@ namespace skydiveLogs_api.Ioc
|
||||
_services.AddScoped<IUserRepository, UserRepository>();
|
||||
_services.AddScoped<IUserImageRepository, UserImageRepository>();
|
||||
_services.AddScoped<IFavoriteDropZoneRepository, FavoriteDropZoneRepository>();
|
||||
_services.AddScoped<IUserStatsRepository, UserStatsRepository>();
|
||||
_services.AddScoped<ITunnelFlightRepository, TunnelFlightRepository>();
|
||||
|
||||
_services.AddScoped<IStatsByDzRepository, StatsByDzRepository>();
|
||||
_services.AddScoped<IStatsByGearRepository, StatsByGearRepository>();
|
||||
_services.AddScoped<IStatsByJumpTypeRepository, StatsByJumpTypeRepository>();
|
||||
_services.AddScoped<IStatsByYearByJumpTypeRepository, StatsByYearByJumpTypeRepository>();
|
||||
_services.AddScoped<IStatsByYearRepository, StatsByYearRepository>();
|
||||
_services.AddScoped<IStatsForLastMonthByDzRepository, StatsForLastMonthByDzRepository>();
|
||||
_services.AddScoped<IStatsForLastMonthByJumpTypeRepository, StatsForLastMonthByJumpTypeRepository>();
|
||||
_services.AddScoped<IStatsForLastYearByDzRepository, StatsForLastYearByDzRepository>();
|
||||
_services.AddScoped<IStatsForLastYearByJumpTypeRepository, StatsForLastYearByJumpTypeRepository>();
|
||||
|
||||
string connectionString = _configuration.GetConnectionString("DefaultConnection");
|
||||
_services.AddSingleton<IDataProvider>(c => new LiteDbProvider(connectionString));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user