This commit is contained in:
2026-01-23 22:52:51 +01:00
parent e84d6e98c9
commit 668f321c54
51 changed files with 580 additions and 3329 deletions

View File

@@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace skydiveLogs_api.Infrastructure
{
public class StatsByGearRepository : IStatsRepository<StatsByGear>
public class StatsByGearRepository : IStatsByGearRepository
{
#region Public Constructors
@@ -20,14 +20,17 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
public int Add(StatsByGear newStats)
public int Add(IEnumerable<StatsByGear> newStats)
{
int result;
int result = 0;
try
{
var tmp = _col.Insert(newStats);
result = tmp.AsInt32;
foreach (var newStat in newStats)
{
var tmp = _col.Insert(newStats);
result = tmp;
}
}
catch
{
@@ -37,17 +40,26 @@ namespace skydiveLogs_api.Infrastructure
return result;
}
public StatsByGear GetAll(User user)
public IEnumerable<StatsByGear> GetAll(User user)
{
return _col.Include(x => x.User)
.Query()
.Where(j => j.User.Id == user.Id)
.SingleOrDefault();
.ToList();
}
public bool Update(StatsByGear stats)
public bool Update(IEnumerable<StatsByGear> updatedStats, User user)
{
return _col.Update(stats);
Delete(user);
var tmp = Add(updatedStats);
return tmp != 0;
}
public bool Delete(User user)
{
var tmp = _col.DeleteMany(s => s.User.Id == user.Id);
return tmp != 0;
}
#endregion Public Methods