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 StatsByDzRepository : IStatsRepository<StatsByDz>
public class StatsByDzRepository : IStatsByDzRepository
{
#region Public Constructors
@@ -20,14 +20,17 @@ namespace skydiveLogs_api.Infrastructure
#region Public Methods
public int Add(StatsByDz newStats)
public int Add(IEnumerable<StatsByDz> 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 StatsByDz GetAll(User user)
public IEnumerable<StatsByDz> GetAll(User user)
{
return _col.Include(x => x.User)
.Query()
.Where(j => j.User.Id == user.Id)
.SingleOrDefault();
.ToList();
}
public bool Update(StatsByDz stats)
public bool Update(IEnumerable<StatsByDz> 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